<!DOCTYPE html>
<html dir="ltr" class="client-js ve-not-available" lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>C++11 - Wikipedia, the free encyclopedia</title>
<meta name="generator" content="MediaWiki 1.24wmf14">
<link rel="alternate" href="android-app://org.wikipedia/http/en.m.wikipedia.org/wiki/C%2B%2B11">
<link rel="alternate" type="application/x-wiki" title="Edit this page" href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit">
<link rel="edit" title="Edit this page" href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit">
<link rel="apple-touch-icon" href="http://bits.wikimedia.org/apple-touch/wikipedia.png">
<link rel="shortcut icon" href="http://bits.wikimedia.org/favicon/wikipedia.ico">
<link rel="search" type="application/opensearchdescription+xml" href="http://en.wikipedia.org/w/opensearch_desc.php" title="Wikipedia (en)">
<link rel="EditURI" type="application/rsd+xml" href="http://en.wikipedia.org/w/api.php?action=rsd">
<link rel="copyright" href="http://creativecommons.org/licenses/by-sa/3.0/">
<link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="http://en.wikipedia.org/w/index.php?title=Special:RecentChanges&amp;feed=atom">
<link rel="canonical" href="http://en.wikipedia.org/wiki/C%2B%2B11">
<link rel="stylesheet" href="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/load_002.css">
<style>
@media print{#centralNotice{display:none}}
/* cache key: enwiki:resourceloader:filter:minify-css:7:ddb0c98a055632ae8e349c9cf48ac703 */
.tipsy{padding:5px;position:absolute;z-index:100000;cursor:default}.tipsy-inner{padding:5px 8px 4px 8px; background-color:#ffffff;border:solid 1px #a7d7f9;color:black;max-width:15em;border-radius:4px; }.tipsy-arrow{position:absolute;background:url() no-repeat top left;background:url(//bits.wikimedia.org/static-1.24wmf15/resources/src/jquery.tipsy/images/tipsy.png?2014-07-24T17:18:20Z) no-repeat top left!ie;width:11px;height:6px} .tipsy-n .tipsy-arrow{top:0px;left:50%;margin-left:-5px} .tipsy-nw .tipsy-arrow{top:1px;left:10px} .tipsy-ne .tipsy-arrow{top:1px;right:10px} .tipsy-s .tipsy-arrow{bottom:0px;left:50%;margin-left:-5px;background-position:bottom left} .tipsy-sw .tipsy-arrow{bottom:0px;left:10px;background-position:bottom left} .tipsy-se .tipsy-arrow{bottom:0px;right:10px;background-position:bottom left} .tipsy-e .tipsy-arrow{top:50%;margin-top:-5px;right:1px;width:5px;height:11px;background-position:top right} .tipsy-w .tipsy-arrow{top:50%;margin-top:-5px;left:0px;width:6px;height:11px}
/* cache key: enwiki:resourceloader:filter:minify-css:7:51bac44d8e07e8f5805583c22617ee00 */
.uls-menu a{cursor:pointer}.uls-menu.callout .caret-before{border-top:20px solid transparent;border-right:20px solid #C9C9C9;border-bottom:20px solid transparent;display:inline-block;left:-21px;top:30px;position:absolute}.uls-menu.callout .caret-after{border-top:20px solid transparent;border-right:20px solid #FCFCFC;border-bottom:20px solid transparent;display:inline-block;left:-20px;top:30px;position:absolute}.uls-ui-languages button{width:23%;text-overflow:ellipsis;margin-right:4%}button.uls-more-languages{width:auto}.settings-title{font-size:11pt}.settings-text{color:#555555;font-size:9pt}div.display-settings-block:hover .settings-text{color:#252525}
/* cache key: enwiki:resourceloader:filter:minify-css:7:22d1681fa868b4ff4fbcb1ec1e58a9ea */
@-webkit-keyframes centralAuthPPersonalAnimation{0%{opacity:0;-webkit-transform:translateY(-20px)}100%{opacity:1;-webkit-transform:translateY(0)}}@-moz-keyframes centralAuthPPersonalAnimation{0%{opacity:0;-moz-transform:translateY(-20px)}100%{opacity:1;-moz-transform:translateY(0)}}@-o-keyframes centralAuthPPersonalAnimation{0%{opacity:0;-o-transform:translateY(-20px)}100%{opacity:1;-o-transform:translateY(0)}}@keyframes centralAuthPPersonalAnimation{0%{opacity:0;transform:translateY(-20px)}100%{opacity:1;transform:translateY(0)}}.centralAuthPPersonalAnimation{-webkit-animation-duration:1s;-moz-animation-duration:1s;-o-animation-duration:1s;animation-duration:1s;-webkit-animation-fill-mode:both;-moz-animation-fill-mode:both;-o-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:centralAuthPPersonalAnimation;-moz-animation-name:centralAuthPPersonalAnimation;-o-animation-name:centralAuthPPersonalAnimation;animation-name:centralAuthPPersonalAnimation}
/* cache key: enwiki:resourceloader:filter:minify-css:7:0dcacc990dd02e7db9669ab3090b80f1 */
.mw-editsection{white-space:nowrap; unicode-bidi:-moz-isolate;unicode-bidi:-webkit-isolate;unicode-bidi:isolate}.mw-editsection-divider{color:#555}.ve-tabmessage-appendix{font-size:0.7em;vertical-align:top;line-height:1.43em;padding-left:0.5em; background-image:none !important;display:inline !important}
/* cache key: enwiki:resourceloader:filter:minify-css:7:50c6a67a11952da7c9e5053046d794ee */</style><style>
.cite-accessibility-label{position:absolute !important; top:-99999px;clip:rect(1px 1px 1px 1px); clip:rect(1px,1px,1px,1px);padding:0 !important;border:0 !important;height:1px !important;width:1px !important;overflow:hidden}.mw-cite-backlink,.cite-accessibility-label{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}
/* cache key: enwiki:resourceloader:filter:minify-css:7:a59b70abe6ecaa39388bb79ebc509cb0 */
.referencetooltip{position:absolute;list-style:none;list-style-image:none;opacity:0;font-size:10px;margin:0;z-index:5;padding:0}.referencetooltip li{border:#080086 2px solid;max-width:260px;padding:10px 8px 13px 8px;margin:0px;background-color:#F7F7F7;box-shadow:2px 4px 2px rgba(0,0,0,0.3);-moz-box-shadow:2px 4px 2px rgba(0,0,0,0.3);-webkit-box-shadow:2px 4px 2px rgba(0,0,0,0.3)}.referencetooltip li+li{margin-left:7px;margin-top:-2px;border:0;padding:0;height:3px;width:0px;background-color:transparent;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;border-top:12px #080086 solid;border-right:7px transparent solid;border-left:7px transparent solid}.referencetooltip>li+li::after{content:'';border-top:8px #F7F7F7 solid;border-right:5px transparent solid;border-left:5px transparent solid;margin-top:-12px;margin-left:-5px;z-index:1;height:0px;width:0px;display:block}.client-js body .referencetooltip li li{border:none;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;height:auto;width:auto;margin:auto;padding:0;position:static}.RTflipped{padding-top:13px}.referencetooltip.RTflipped li+li{position:absolute;top:2px;border-top:0;border-bottom:12px #080086 solid}.referencetooltip.RTflipped li+li::after{border-top:0;border-bottom:8px #F7F7F7 solid;position:absolute;margin-top:7px}.RTsettings{float:right;height:16px;width:16px;cursor:pointer;background-image:url(//upload.wikimedia.org/wikipedia/commons/e/ed/Cog.png);margin-top:-9px;margin-right:-7px;-webkit-transition:opacity 0.15s;-moz-transition:opacity 0.15s;-o-transition:opacity 0.15s;-ms-transition:opacity 0.15s;transition:opacity 0.15s;opacity:0.6;filter:alpha(opacity=60)}.RTsettings:hover{opacity:1;filter:alpha(opacity=100)}.RTTarget{border:#080086 2px solid}
/* cache key: enwiki:resourceloader:filter:minify-css:7:7efa21f6db726653194905048a6b006a */
.wp-teahouse-question-form{position:absolute;margin-left:auto;margin-right:auto;background-color:#f4f3f0;border:1px solid #a7d7f9;padding:1em}#wp-th-question-ask{float:right}.wp-teahouse-ask a.external{background-image:none !important}.wp-teahouse-respond-form{position:absolute;margin-left:auto;margin-right:auto;background-color:#f4f3f0;border:1px solid #a7d7f9;padding:1em}.wp-th-respond{float:right}.wp-teahouse-respond a.external{background-image:none !important}
/* cache key: enwiki:resourceloader:filter:minify-css:7:8614dfa7ef847fc9bfcc2d1c9f720197 */
#p-lang .uls-settings-trigger{background:transparent url() no-repeat right top;background:transparent url(//bits.wikimedia.org/static-1.24wmf15/extensions/UniversalLanguageSelector/resources/css/../images/cog-sprite.png?2014-07-24T17:21:40Z) no-repeat right top!ie;background-image:-webkit-linear-gradient(transparent,transparent),url();background-image:-webkit-linear-gradient(transparent,transparent),url(//bits.wikimedia.org/static-1.24wmf15/extensions/UniversalLanguageSelector/resources/css/../images/cog-sprite.svg?2014-07-24T17:21:40Z)!ie;background-image:linear-gradient(transparent,transparent),url();background-image:linear-gradient(transparent,transparent),url(//bits.wikimedia.org/static-1.24wmf15/extensions/UniversalLanguageSelector/resources/css/../images/cog-sprite.svg?2014-07-24T17:21:40Z)!ie;height:16px;width:14px;float:right;cursor:pointer}.skin-vector #p-lang .uls-settings-trigger{ margin-top:3px}#p-lang .uls-settings-trigger:hover{background-position:right -16px}
/* cache key: enwiki:resourceloader:filter:minify-css:7:e35dd88acdd30f5be0eff579b3711b98 */
.mw-collapsible-toggle{float:right;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.mw-customtoggle,.mw-collapsible-toggle{cursor:pointer} caption .mw-collapsible-toggle{float:none} li .mw-collapsible-toggle{float:none} .mw-collapsible-toggle-li{list-style:none}
/* cache key: enwiki:resourceloader:filter:minify-css:7:869aa9133c31e6040d4830b259da96a8 */
.suggestions{overflow:hidden;position:absolute;top:0;left:0;width:0;border:none;z-index:1099;padding:0;margin:-1px -1px 0 0} html > body .suggestions{margin:-1px 0 0 0}.suggestions-special{position:relative;background-color:white;cursor:pointer;border:solid 1px #aaaaaa;padding:0;margin:0;margin-top:-2px;display:none;padding:0.25em 0.25em;line-height:1.25em}.suggestions-results{background-color:white;cursor:pointer;border:solid 1px #aaaaaa;padding:0;margin:0}.suggestions-result{color:black;margin:0;line-height:1.5em;padding:0.01em 0.25em;text-align:left; overflow:hidden;-o-text-overflow:ellipsis; text-overflow:ellipsis;white-space:nowrap}.suggestions-result-current{background-color:#4C59A6;color:white}.suggestions-special .special-label{color:gray;text-align:left}.suggestions-special .special-query{color:black;font-style:italic;text-align:left}.suggestions-special .special-hover{background-color:silver}.suggestions-result-current .special-label,.suggestions-result-current .special-query{color:white}.highlight{font-weight:bold}
/* cache key: enwiki:resourceloader:filter:minify-css:7:9f9511aa4ef920d34591113e825e6a1e */
.postedit-container{margin:0 auto;position:fixed;top:0;height:0;left:50%;z-index:1000;font-size:13px}.postedit-container:hover{cursor:pointer}.postedit{position:relative;top:0.6em;left:-50%;padding:.6em 3.6em .6em 1.1em;line-height:1.5625em;color:#626465;background-color:#f4f4f4;border:1px solid #dcd9d9;text-shadow:0 0.0625em 0 rgba(255,255,255,0.5);border-radius:5px;box-shadow:0 2px 5px 0 #ccc;-webkit-transition:all 0.25s ease-in-out;-moz-transition:all 0.25s ease-in-out;-ms-transition:all 0.25s ease-in-out;-o-transition:all 0.25s ease-in-out;transition:all 0.25s ease-in-out}.skin-monobook .postedit{top:6em !important}.postedit-faded{opacity:0}.postedit-icon{padding-left:41px;  line-height:25px;background-repeat:no-repeat;background-position:8px 50%}.postedit-icon-checkmark{background-image:url();background-image:url(//bits.wikimedia.org/static-1.24wmf15/resources/src/mediawiki.action/images/green-checkmark.png?2014-07-24T17:18:20Z)!ie;background-position:left}.postedit-close{position:absolute;padding:0 .8em;right:0;top:0;font-size:1.25em;font-weight:bold;line-height:2.3em;color:black;text-shadow:0 0.0625em 0 white;text-decoration:none;opacity:0.2;filter:alpha(opacity=20)}.postedit-close:hover{color:black;text-decoration:none;opacity:0.4;filter:alpha(opacity=40)}
/* cache key: enwiki:resourceloader:filter:minify-css:7:e4278e03cfe31fd402289d7b127426f6 */
.mw-mmv-overlay{position:fixed;top:0px;left:0px;right:0px;bottom:0px;z-index:1000;background-color:#000000}body.mw-mmv-lightbox-open{overflow-y:auto}body.mw-mmv-lightbox-open #mw-page-base,body.mw-mmv-lightbox-open #mw-head-base,body.mw-mmv-lightbox-open #mw-navigation,body.mw-mmv-lightbox-open #content,body.mw-mmv-lightbox-open #footer,body.mw-mmv-lightbox-open #globalWrapper // monobook{ display:none}body.mw-mmv-lightbox-open > *{ display:none}body.mw-mmv-lightbox-open > .mw-mmv-overlay,body.mw-mmv-lightbox-open > .mw-mmv-wrapper{display:block}.mw-mmv-view-expanded{display:inline-block;border:1px solid #dddddd;padding:5px 10px;padding-left:35px;background-image:url();background-image:url(//bits.wikimedia.org/static-1.24wmf15/extensions/MultimediaViewer/resources/mmv/img/expand.svg?2014-07-24T17:20:00Z)!ie;background-position:left;background-repeat:no-repeat}
/* cache key: enwiki:resourceloader:filter:minify-css:7:db3bb272f4353febe1e83f52e1d023fd */</style><style>
.suggestions a.mw-searchSuggest-link,.suggestions a.mw-searchSuggest-link:hover,.suggestions a.mw-searchSuggest-link:active,.suggestions a.mw-searchSuggest-link:focus{color:black;text-decoration:none}.suggestions-result-current a.mw-searchSuggest-link,.suggestions-result-current a.mw-searchSuggest-link:hover,.suggestions-result-current a.mw-searchSuggest-link:active,.suggestions-result-current a.mw-searchSuggest-link:focus{color:white}.suggestions a.mw-searchSuggest-link .special-query{ overflow:hidden;-o-text-overflow:ellipsis; text-overflow:ellipsis;white-space:nowrap}
/* cache key: enwiki:resourceloader:filter:minify-css:7:ae3fa4570b5ac0c6cf7b3776c8ae4d6f */</style><meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" href="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/load.css">
<style>a:lang(ar),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}
/* cache key: enwiki:resourceloader:filter:minify-css:7:3904d24a08aa08f6a68dc338f9be277e */</style>
<script src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/load_004.php"></script><script src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/load.php"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"C++11","wgTitle":"C++11","wgCurRevisionId":614206455,"wgRevisionId":614206455,"wgArticleId":5481447,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Wikipedia articles needing style editing from July 2012","All articles needing style editing","Articles needing additional references from July 2012","All articles needing additional references","Wikipedia introduction cleanup from July 2012","All pages needing cleanup","Articles covered by WikiProject Wikify from July 2012","All articles covered by WikiProject Wikify","All articles with unsourced statements","Articles with unsourced statements from August 2013","C++","Programming language standards","Articles with example C++ code"],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"C++11","wgIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgWikiEditorEnabledModules":{"toolbar":true,"dialogs":true,"hidesig":true,"preview":false,"previewDialog":false,"publish":false},"wgBetaFeaturesFeatures":[],"wgMediaViewerOnClick":true,"wgVisualEditor":{"isPageWatched":false,"magnifyClipIconURL":"//bits.wikimedia.org/static-1.24wmf14/skins/common/images/magnify-clip.png","pageLanguageCode":"en","pageLanguageDir":"ltr","svgMaxSize":2048,"namespacesWithSubpages":{"6":0,"8":0,"1":true,"2":true,"3":true,"4":true,"5":true,"7":true,"9":true,"10":true,"11":true,"12":true,"13":true,"14":true,"15":true,"100":true,"101":true,"102":true,"103":true,"104":true,"105":true,"106":true,"107":true,"108":true,"109":true,"110":true,"111":true,"447":true,"2600":false,"828":true,"829":true}},"wikilove-recipient":"","wikilove-anon":0,"wgGuidedTourHelpGuiderUrl":"Help:Guided tours/guider","wgULSAcceptLanguageList":["en-us","en"],"wgULSCurrentAutonym":"English","wgFlaggedRevsParams":{"tags":{"status":{"levels":1,"quality":2,"pristine":3}}},"wgStableRevisionId":null,"wgCategoryTreePageCategoryOptions":"{\"mode\":0,\"hideprefix\":20,\"showcount\":true,\"namespaces\":false}","wgNoticeProject":"wikipedia","wgWikibaseItemId":"Q1061570"});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function($,jQuery){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"editfont":"default","editondblclick":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"math":0,"minordefault":0,"newpageshidepatrolled":0,"nickname":"","norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"rcdays":7,"rclimit":50,"rows":25,"showhiddencats":false,"shownumberswatching":1,"showtoolbar":1,"skin":"vector","stubthreshold":0,"thumbsize":4,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":1,"watchdefault":0,"watchdeletion":0,"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,
"useeditwarning":1,"prefershttps":1,"flaggedrevssimpleui":1,"flaggedrevsstable":0,"flaggedrevseditdiffs":true,"flaggedrevsviewdiffs":false,"usebetatoolbar":1,"usebetatoolbar-cgd":1,"multimediaviewer-enable":true,"visualeditor-enable":0,"visualeditor-betatempdisable":0,"visualeditor-enable-experimental":0,"visualeditor-enable-language":0,"visualeditor-hidebetawelcome":0,"wikilove-enabled":1,"mathJax":false,"echo-subscriptions-web-page-review":true,"echo-subscriptions-email-page-review":false,"ep_showtoplink":false,"ep_bulkdelorgs":false,"ep_bulkdelcourses":true,"ep_showdyk":true,"echo-subscriptions-web-education-program":true,"echo-subscriptions-email-education-program":false,"echo-notify-show-link":true,"echo-show-alert":true,"echo-email-frequency":0,"echo-email-format":"html","echo-subscriptions-email-system":true,"echo-subscriptions-web-system":true,"echo-subscriptions-email-user-rights":true,"echo-subscriptions-web-user-rights":true,"echo-subscriptions-email-other":false,
"echo-subscriptions-web-other":true,"echo-subscriptions-email-edit-user-talk":false,"echo-subscriptions-web-edit-user-talk":true,"echo-subscriptions-email-reverted":false,"echo-subscriptions-web-reverted":true,"echo-subscriptions-email-article-linked":false,"echo-subscriptions-web-article-linked":false,"echo-subscriptions-email-mention":false,"echo-subscriptions-web-mention":true,"echo-subscriptions-web-edit-thank":true,"echo-subscriptions-email-edit-thank":false,"echo-subscriptions-web-flow-discussion":true,"echo-subscriptions-email-flow-discussion":false,"gettingstarted-task-toolbar-show-intro":true,"uls-preferences":"","language":"en","variant-gan":"gan","variant-iu":"iu","variant-kk":"kk","variant-ku":"ku","variant-shi":"shi","variant-sr":"sr","variant-tg":"tg","variant-uz":"uz","variant-zh":"zh","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,
"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"searchNs100":false,"searchNs101":false,"searchNs108":false,"searchNs109":false,"searchNs118":false,"searchNs119":false,"searchNs446":false,"searchNs447":false,"searchNs710":false,"searchNs711":false,"searchNs828":false,"searchNs829":false,"searchNs2600":false,"gadget-teahouse":1,"gadget-ReferenceTooltips":1,"gadget-DRN-wizard":1,"gadget-charinsert":1,"gadget-refToolbar":1,"gadget-mySandbox":1,"variant":"en"});},{},{});mw.loader.implement("user.tokens",function($,jQuery){mw.user.tokens.set({"editToken":"+\\","patrolToken":false,"watchToken":false});},{},{});
/* cache key: enwiki:resourceloader:filter:minify-js:7:ffff827f827051d73171f6b2dc70d368 */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax","ext.centralauth.centralautologin","mmv.head","ext.visualEditor.viewPageTarget.init","ext.uls.init","ext.uls.interface","ext.centralNotice.bannerController","skins.vector.js"]);
}</script><script src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/load_002.php"></script>
<link rel="dns-prefetch" href="http://meta.wikimedia.org/">
<!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/static-1.24wmf14/skins/Vector/csshover.min.htc")}</style><![endif]-->
<style type="text/css"> #fi #fic {margin-right:100px !important}  #fi #rh {margin-left:-115px !important;width:95px !important}  #fi .rh {display:none !important}  body:not(.xE) div[role='main'] .Bu:not(:first-child) {display: none !important} </style><link href="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/sbi.css" rel="stylesheet" type="text/css" id="sbi-style"></head>
<body ryt12142="1" class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-C_11 skin-vector action-view vector-animateLayout">
		<div id="mw-page-base" class="noprint"></div>
		<div id="mw-head-base" class="noprint"></div>
		<div id="content" class="mw-body" role="main">
			<a id="top"></a>

			<div id="mw-js-message" style="display:none;"></div>
							<div id="siteNotice"><div id="centralNotice"></div><!-- CentralNotice --></div>
						<h1 id="firstHeading" class="firstHeading" lang="en"><span dir="auto">C++11</span></h1>
						<div id="bodyContent" class="mw-body-content">
									<div id="siteSub">From Wikipedia, the free encyclopedia</div>
								<div id="contentSub"></div>
												<div id="jump-to-nav" class="mw-jump">
					Jump to:					<a href="#mw-navigation">navigation</a>, 					<a href="#p-search">search</a>
				</div>
				<div id="mw-content-text" dir="ltr" class="mw-content-ltr" lang="en"><table class="metadata plainlinks ambox ambox-content ambox-multiple_issues compact-ambox" role="presentation">
<tbody><tr>
<td class="mbox-image">
<div style="width:52px;"><img alt="" src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/Ambox_content.png" data-file-width="40" data-file-height="40" height="40" width="40"></div>
</td>
<td class="mbox-text">
<table id="collapsibleTable0" class="collapsible" style="width:95%; background:transparent;">
<tbody><tr>
<th style="text-align:left; padding:0.2em 2px 0.2em 0;"><span class="collapseButton">[<a href="#" id="collapseButton0">hide</a>]</span>This article has multiple issues. <span style="font-weight: normal;">Please help <b><a class="external text" href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit">improve it</a></b> or discuss these issues on the <b><a href="http://en.wikipedia.org/wiki/Talk:C%2B%2B11" title="Talk:C++11">talk page</a></b>.</span></th>
</tr>
<tr>
<td>
<table class="metadata plainlinks ambox ambox-style" role="presentation">
<tbody><tr>
<td class="mbox-image">
<div style="width:52px;"><img alt="" src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/40px-Edit-clear.png" srcset="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/60px-Edit-clear.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/80px-Edit-clear.svg.png 2x" data-file-width="48" data-file-height="48" height="40" width="40"></div>
</td>
<td class="mbox-text"><span class="mbox-text-span">This article <b>is written like <a href="http://en.wikipedia.org/wiki/Wikipedia:NOT#GUIDE" title="Wikipedia:NOT" class="mw-redirect">a manual or guidebook</a>.</b> <span class="hide-when-compact">Please help <a class="external text" href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit">rewrite this article</a> from a descriptive, <a href="http://en.wikipedia.org/wiki/Wikipedia:Neutral_point_of_view" title="Wikipedia:Neutral point of view">neutral point of view</a>, and remove advice or instruction.</span> <small><i>(July 2012)</i></small></span></td>
</tr>
</tbody></table>
<table class="metadata plainlinks ambox ambox-content ambox-Refimprove" role="presentation">
<tbody><tr>
<td class="mbox-image">
<div style="width:52px;"><a href="http://en.wikipedia.org/wiki/File:Question_book-new.svg" class="image"><img alt="" src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/50px-Question_book-new.png" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/75px-Question_book-new.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/100px-Question_book-new.svg.png 2x" data-file-width="262" data-file-height="204" height="39" width="50"></a></div>
</td>
<td class="mbox-text"><span class="mbox-text-span">This article <b>needs additional citations for <a href="http://en.wikipedia.org/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability">verification</a></b>. <span class="hide-when-compact">Please help <a class="external text" href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit">improve this article</a> by <a href="http://en.wikipedia.org/wiki/Help:Introduction_to_referencing/1" title="Help:Introduction to referencing/1">adding citations to reliable sources</a>. Unsourced material may be challenged and removed.</span> <small><i>(July 2012)</i></small></span></td>
</tr>
</tbody></table>
<table class="metadata plainlinks ambox ambox-style ambox-lead_too_short" role="presentation">
<tbody><tr>
<td class="mbox-image">
<div style="width:52px;"><img alt="" src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/40px-Edit-clear.png" srcset="//upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/60px-Edit-clear.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/f/f2/Edit-clear.svg/80px-Edit-clear.svg.png 2x" data-file-width="48" data-file-height="48" height="40" width="40"></div>
</td>
<td class="mbox-text"><span class="mbox-text-span">This article's <b><a href="http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Lead_section" title="Wikipedia:Manual of Style/Lead section">lead section</a> may not adequately <a href="http://en.wikipedia.org/wiki/Wikipedia:Summary_style" title="Wikipedia:Summary style">summarize</a> key points of its contents</b>. <span class="hide-when-compact">Please consider expanding the lead to <a href="http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Lead_section#Provide_an_accessible_overview" title="Wikipedia:Manual of Style/Lead section">provide an accessible overview</a> of all important aspects of the article.</span> <small><i>(July 2012)</i></small></span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<p><b>C++11</b> (formerly known as <b>C++0x</b>) is the most recent version of the standard of the <a href="http://en.wikipedia.org/wiki/C%2B%2B" title="C++">C++ programming language</a>. It was approved by <a href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization" title="International Organization for Standardization">ISO</a> on 12 August 2011, replacing <a href="http://en.wikipedia.org/wiki/C%2B%2B03" title="C++03">C++03</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span>[</span>1<span>]</span></a></sup> The name follows the tradition of naming language versions by the year of the specification's publication.</p>
<p>C++11 includes several additions to the <a href="http://en.wikipedia.org/wiki/Core_language" title="Core language">core language</a> and extends the <a href="http://en.wikipedia.org/wiki/C%2B%2B_standard_library" title="C++ standard library" class="mw-redirect">C++ standard library</a>, incorporating most of the <a href="http://en.wikipedia.org/wiki/C%2B%2B_Technical_Report_1" title="C++ Technical Report 1">C++ Technical Report 1</a> (TR1) <a href="http://en.wikipedia.org/wiki/Library_%28computer_science%29" title="Library (computer science)" class="mw-redirect">libraries</a> — with the exception of the library of mathematical special functions.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span>[</span>2<span>]</span></a></sup> C++11 was published as <i>ISO/IEC 14882:2011</i><sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span>[</span>3<span>]</span></a></sup>
 in September 2011 and is available for a fee. The working draft most 
similar to the published C++11 standard is N3337, dated 16 January 2012;<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span>[</span>4<span>]</span></a></sup> it has only editorial corrections from the C++11 standard.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span>[</span>5<span>]</span></a></sup></p>
<p>Work is currently under way on the <a href="http://en.wikipedia.org/wiki/C%2B%2B14" title="C++14">C++14</a> and <a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B17&amp;action=edit&amp;redlink=1" class="new" title="C++17 (page does not exist)">C++17</a> standards.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span>[</span>6<span>]</span></a></sup></p>
<p></p>
<div id="toc" class="toc">
<div id="toctitle">
<h2>Contents</h2>
<span class="toctoggle">&nbsp;[<a href="#" class="internal" id="togglelink">hide</a>]&nbsp;</span></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Changes_from_the_previous_version_of_the_standard"><span class="tocnumber">1</span> <span class="toctext">Changes from the previous version of the standard</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Extensions_to_the_C.2B.2B_core_language"><span class="tocnumber">2</span> <span class="toctext">Extensions to the C++ core language</span></a>
<ul>
<li class="toclevel-2 tocsection-3"><a href="#Core_language_runtime_performance_enhancements"><span class="tocnumber">2.1</span> <span class="toctext">Core language runtime performance enhancements</span></a>
<ul>
<li class="toclevel-3 tocsection-4"><a href="#Rvalue_references_and_move_constructors"><span class="tocnumber">2.1.1</span> <span class="toctext">Rvalue references and move constructors</span></a></li>
<li class="toclevel-3 tocsection-5"><a href="#constexpr_.E2.80.93_Generalized_constant_expressions"><span class="tocnumber">2.1.2</span> <span class="toctext">constexpr – Generalized constant expressions</span></a></li>
<li class="toclevel-3 tocsection-6"><a href="#Modification_to_the_definition_of_plain_old_data"><span class="tocnumber">2.1.3</span> <span class="toctext">Modification to the definition of plain old data</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-7"><a href="#Core_language_build_time_performance_enhancements"><span class="tocnumber">2.2</span> <span class="toctext">Core language build time performance enhancements</span></a>
<ul>
<li class="toclevel-3 tocsection-8"><a href="#Extern_template"><span class="tocnumber">2.2.1</span> <span class="toctext">Extern template</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-9"><a href="#Core_language_usability_enhancements"><span class="tocnumber">2.3</span> <span class="toctext">Core language usability enhancements</span></a>
<ul>
<li class="toclevel-3 tocsection-10"><a href="#Initializer_lists"><span class="tocnumber">2.3.1</span> <span class="toctext">Initializer lists</span></a></li>
<li class="toclevel-3 tocsection-11"><a href="#Uniform_initialization"><span class="tocnumber">2.3.2</span> <span class="toctext">Uniform initialization</span></a></li>
<li class="toclevel-3 tocsection-12"><a href="#Type_inference"><span class="tocnumber">2.3.3</span> <span class="toctext">Type inference</span></a></li>
<li class="toclevel-3 tocsection-13"><a href="#Range-based_for_loop"><span class="tocnumber">2.3.4</span> <span class="toctext">Range-based for loop</span></a></li>
<li class="toclevel-3 tocsection-14"><a href="#Lambda_functions_and_expressions"><span class="tocnumber">2.3.5</span> <span class="toctext">Lambda functions and expressions</span></a></li>
<li class="toclevel-3 tocsection-15"><a href="#Alternative_function_syntax"><span class="tocnumber">2.3.6</span> <span class="toctext"> Alternative function syntax</span></a></li>
<li class="toclevel-3 tocsection-16"><a href="#Object_construction_improvement"><span class="tocnumber">2.3.7</span> <span class="toctext">Object construction improvement</span></a></li>
<li class="toclevel-3 tocsection-17"><a href="#Explicit_overrides_and_final"><span class="tocnumber">2.3.8</span> <span class="toctext">Explicit overrides and final</span></a></li>
<li class="toclevel-3 tocsection-18"><a href="#Null_pointer_constant"><span class="tocnumber">2.3.9</span> <span class="toctext">Null pointer constant</span></a></li>
<li class="toclevel-3 tocsection-19"><a href="#Strongly_typed_enumerations"><span class="tocnumber">2.3.10</span> <span class="toctext">Strongly typed enumerations</span></a></li>
<li class="toclevel-3 tocsection-20"><a href="#Right_angle_bracket"><span class="tocnumber">2.3.11</span> <span class="toctext">Right angle bracket</span></a></li>
<li class="toclevel-3 tocsection-21"><a href="#Explicit_conversion_operators"><span class="tocnumber">2.3.12</span> <span class="toctext">Explicit conversion operators</span></a></li>
<li class="toclevel-3 tocsection-22"><a href="#Alias_templates"><span class="tocnumber">2.3.13</span> <span class="toctext">Alias templates</span></a></li>
<li class="toclevel-3 tocsection-23"><a href="#Unrestricted_unions"><span class="tocnumber">2.3.14</span> <span class="toctext">Unrestricted unions</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-24"><a href="#Core_language_functionality_improvements"><span class="tocnumber">2.4</span> <span class="toctext">Core language functionality improvements</span></a>
<ul>
<li class="toclevel-3 tocsection-25"><a href="#Variadic_templates"><span class="tocnumber">2.4.1</span> <span class="toctext">Variadic templates</span></a></li>
<li class="toclevel-3 tocsection-26"><a href="#New_string_literals"><span class="tocnumber">2.4.2</span> <span class="toctext">New string literals</span></a></li>
<li class="toclevel-3 tocsection-27"><a href="#User-defined_literals"><span class="tocnumber">2.4.3</span> <span class="toctext">User-defined literals</span></a></li>
<li class="toclevel-3 tocsection-28"><a href="#Multithreading_memory_model"><span class="tocnumber">2.4.4</span> <span class="toctext">Multithreading memory model</span></a></li>
<li class="toclevel-3 tocsection-29"><a href="#Thread-local_storage"><span class="tocnumber">2.4.5</span> <span class="toctext">Thread-local storage</span></a></li>
<li class="toclevel-3 tocsection-30"><a href="#Explicitly_defaulted_and_deleted_special_member_functions"><span class="tocnumber">2.4.6</span> <span class="toctext">Explicitly defaulted and deleted special member functions</span></a></li>
<li class="toclevel-3 tocsection-31"><a href="#Type_long_long_int"><span class="tocnumber">2.4.7</span> <span class="toctext">Type long long int</span></a></li>
<li class="toclevel-3 tocsection-32"><a href="#Static_assertions"><span class="tocnumber">2.4.8</span> <span class="toctext">Static assertions</span></a></li>
<li class="toclevel-3 tocsection-33"><a href="#Allow_sizeof_to_work_on_members_of_classes_without_an_explicit_object"><span class="tocnumber">2.4.9</span> <span class="toctext">Allow sizeof to work on members of classes without an explicit object</span></a></li>
<li class="toclevel-3 tocsection-34"><a href="#Control_and_query_object_alignment"><span class="tocnumber">2.4.10</span> <span class="toctext">Control and query object alignment</span></a></li>
<li class="toclevel-3 tocsection-35"><a href="#Allow_garbage_collected_implementations"><span class="tocnumber">2.4.11</span> <span class="toctext">Allow garbage collected implementations</span></a></li>
<li class="toclevel-3 tocsection-36"><a href="#Attributes"><span class="tocnumber">2.4.12</span> <span class="toctext">Attributes</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1 tocsection-37"><a href="#C.2B.2B_standard_library_changes"><span class="tocnumber">3</span> <span class="toctext">C++ standard library changes</span></a>
<ul>
<li class="toclevel-2 tocsection-38"><a href="#Upgrades_to_standard_library_components"><span class="tocnumber">3.1</span> <span class="toctext">Upgrades to standard library components</span></a></li>
<li class="toclevel-2 tocsection-39"><a href="#Threading_facilities"><span class="tocnumber">3.2</span> <span class="toctext">Threading facilities</span></a></li>
<li class="toclevel-2 tocsection-40"><a href="#Tuple_types"><span class="tocnumber">3.3</span> <span class="toctext">Tuple types</span></a></li>
<li class="toclevel-2 tocsection-41"><a href="#Hash_tables"><span class="tocnumber">3.4</span> <span class="toctext">Hash tables</span></a></li>
<li class="toclevel-2 tocsection-42"><a href="#Regular_expressions"><span class="tocnumber">3.5</span> <span class="toctext">Regular expressions</span></a></li>
<li class="toclevel-2 tocsection-43"><a href="#General-purpose_smart_pointers"><span class="tocnumber">3.6</span> <span class="toctext">General-purpose smart pointers</span></a></li>
<li class="toclevel-2 tocsection-44"><a href="#Extensible_random_number_facility"><span class="tocnumber">3.7</span> <span class="toctext">Extensible random number facility</span></a></li>
<li class="toclevel-2 tocsection-45"><a href="#Wrapper_reference"><span class="tocnumber">3.8</span> <span class="toctext">Wrapper reference</span></a></li>
<li class="toclevel-2 tocsection-46"><a href="#Polymorphic_wrappers_for_function_objects"><span class="tocnumber">3.9</span> <span class="toctext">Polymorphic wrappers for function objects</span></a></li>
<li class="toclevel-2 tocsection-47"><a href="#Type_traits_for_metaprogramming"><span class="tocnumber">3.10</span> <span class="toctext">Type traits for metaprogramming</span></a></li>
<li class="toclevel-2 tocsection-48"><a href="#Uniform_method_for_computing_the_return_type_of_function_objects"><span class="tocnumber">3.11</span> <span class="toctext">Uniform method for computing the return type of function objects</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-49"><a href="#Improved_C_compatibility"><span class="tocnumber">4</span> <span class="toctext">Improved C compatibility</span></a></li>
<li class="toclevel-1 tocsection-50"><a href="#Features_originally_planned_but_removed_or_not_included"><span class="tocnumber">5</span> <span class="toctext">Features originally planned but removed or not included</span></a></li>
<li class="toclevel-1 tocsection-51"><a href="#Features_removed_or_deprecated"><span class="tocnumber">6</span> <span class="toctext">Features removed or deprecated</span></a></li>
<li class="toclevel-1 tocsection-52"><a href="#See_also"><span class="tocnumber">7</span> <span class="toctext">See also</span></a></li>
<li class="toclevel-1 tocsection-53"><a href="#References"><span class="tocnumber">8</span> <span class="toctext">References</span></a></li>
<li class="toclevel-1 tocsection-54"><a href="#External_links"><span class="tocnumber">9</span> <span class="toctext">External links</span></a></li>
</ul>
</div>
<p></p>
<h2><span class="mw-headline" id="Changes_from_the_previous_version_of_the_standard">Changes from the previous version of the standard</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=1" title="Edit section: Changes from the previous version of the standard">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>The modifications for C++ involve both the core language and the standard library.</p>
<p>In the development of every utility of the 2011 standard, the committee has applied some directives:</p>
<ul>
<li>Maintain stability and compatibility with <a href="http://en.wikipedia.org/wiki/ISO/IEC_14882" title="ISO/IEC 14882" class="mw-redirect">C++98</a> and possibly with <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C</a>;</li>
<li>Prefer introduction of new features through the standard library, rather than extending the core language;</li>
<li>Prefer changes that can evolve programming technique;</li>
<li>Improve C++ to facilitate systems and library design, rather than to
 introduce new features useful only to specific applications;</li>
<li>Increase type safety by providing safer alternatives to earlier unsafe techniques;</li>
<li>Increase performance and the ability to work directly with hardware;</li>
<li>Provide proper solutions for real-world problems;</li>
<li>Implement “zero-overhead” principle (additional support required by some utilities must be used only if the utility is used);</li>
<li>Make C++ easy to teach and to learn without removing any utility needed by expert programmers.</li>
</ul>
<p>Attention to beginners is considered important, because they will 
always compose the majority of computer programmers, and because many 
beginners would not intend to extend their knowledge of <span class="nowrap">C++</span>, limiting themselves to operate in the aspects of the language in which they are specialized.<sup class="reference plainlinks nourlexpansion" id="ref_web-strou-brief"><a class="external autonumber" href="http://en.wikipedia.org/wiki/C%2B%2B11#endnote_web-strou-brief">[1]</a></sup></p>
<h2><span class="mw-headline" id="Extensions_to_the_C.2B.2B_core_language">Extensions to the C++ core language</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=2" title="Edit section: Extensions to the C++ core language">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>One function of the C++ committee is the development of the language 
core. Areas of the core language that were significantly improved 
include <a href="http://en.wikipedia.org/wiki/Thread_%28computer_science%29" title="Thread (computer science)" class="mw-redirect">multithreading</a> support, <a href="http://en.wikipedia.org/wiki/Generic_programming" title="Generic programming">generic programming</a> support, uniform initialization, and performance enhancements.</p>
<p>For the purposes of this article, core language features and changes 
are grouped into four general sections: run-time performance 
enhancements, build-time performance enhancements, usability 
enhancements, and new functionality. Some features could fall into 
multiple groups, but they are mentioned only in the group that primarily
 represents that feature.</p>
<h3><span class="mw-headline" id="Core_language_runtime_performance_enhancements">Core language runtime performance enhancements</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=3" title="Edit section: Core language runtime performance enhancements">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>These language features primarily exist to provide some kind of performance benefit, either of memory or of computational speed.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="http://en.wikipedia.org/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (August 2013)">citation needed</span></a></i>]</sup></p>
<h4><span class="mw-headline" id="Rvalue_references_and_move_constructors">Rvalue references and move constructors</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=4" title="Edit section: Rvalue references and move constructors">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03 (and before), temporaries (termed "<a href="http://en.wikipedia.org/wiki/Value_%28computer_science%29" title="Value (computer science)">rvalues</a>",
 as they often lie on the right side of an assignment) were intended to 
never be modifiable — just as in C — and were considered to be 
indistinguishable from <code>const T&amp;</code> types; nevertheless, in
 some cases, temporaries could have been modified, a behavior that was 
even considered to be a useful loophole (for the former, see "C++ coding
 standards" #15 <sup id="cite_ref-Sutter_Alexandrescu_7-0" class="reference"><a href="#cite_note-Sutter_Alexandrescu-7"><span>[</span>7<span>]</span></a></sup>). C++11 adds a new non-const reference type called an <span id="rvalue_reference">rvalue reference</span>, identified by <code>T&amp;&amp;</code>.
 This refers to temporaries that are permitted to be modified after they
 are initialized, for the purpose of allowing "move semantics".</p>
<p>A chronic performance problem with C++03 is the costly and 
unnecessary deep copies that can happen implicitly when objects are 
passed by value. To illustrate the issue, consider that a <code>std::vector&lt;T&gt;</code> is, internally, a wrapper around a C-style array with a size. If a <code>std::vector&lt;T&gt;</code> temporary is created or returned from a function, it can be stored only by creating a new <code>std::vector&lt;T&gt;</code>
 and copying all of the rvalue's data into it. Then the temporary and 
all its memory is destroyed. (For simplicity, this discussion neglects 
the <a href="http://en.wikipedia.org/wiki/Return_value_optimization" title="Return value optimization">return value optimization</a>.)</p>
<p>In C++11, a <a href="http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Move_Constructor" class="extiw" title="b:More C++ Idioms/Move Constructor"><span id="move_constructor">move constructor</span></a> of <code>std::vector&lt;T&gt;</code> that takes an rvalue reference to a <code>std::vector&lt;T&gt;</code> can copy the pointer to the internal C-style array out of the rvalue into the new <code>std::vector&lt;T&gt;</code>,
 then set the pointer inside the rvalue to null. Since the temporary 
will never again be used, no code will try to access the null pointer, 
and because the pointer is null, its memory is not deleted when it goes 
out of scope. Hence, the operation not only forgoes the expense of a 
deep copy, but is safe and invisible.</p>
<p>Rvalue references can provide performance benefits to existing code 
without needing to make any changes outside the standard library. The 
type of the returned value of a function returning a <code>std::vector&lt;T&gt;</code> temporary does not need to be changed explicitly to <code>std::vector&lt;T&gt; &amp;&amp;</code> to invoke the move constructor, as temporaries are considered rvalues automatically. (However, if <code>std::vector&lt;T&gt;</code> is a C++03 version without a move constructor, then the copy constructor will be invoked with a <code>const std::vector&lt;T&gt;&amp;</code>, incurring a significant memory allocation.)</p>
<p>For safety reasons, some restrictions are imposed. A named variable 
will never be considered to be an rvalue even if it is declared as such;
 in order to get an rvalue, the function template <code>std::move()</code>
 should be used. Rvalue references can also be modified only under 
certain circumstances, being intended to be used primarily with move 
constructors.</p>
<p>Due to the nature of the wording of rvalue references, and to some 
modification to the wording for lvalue references (regular references), 
rvalue references allow developers to provide perfect function 
forwarding. When combined with <a href="#Variadic_templates">variadic templates</a>,
 this ability allows for function templates that can perfectly forward 
arguments to another function that takes those particular arguments. 
This is most useful for forwarding constructor parameters, to create 
factory functions that will automatically call the correct constructor 
for those particular arguments. This is seen in the <a rel="nofollow" class="external text" href="http://en.cppreference.com/w/cpp/container/vector/emplace_back">emplace_back</a> set of the C++ standard library methods.</p>
<h4><span class="mw-headline" id="constexpr_.E2.80.93_Generalized_constant_expressions">constexpr – Generalized constant expressions</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=5" title="Edit section: constexpr – Generalized constant expressions">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++ has always had the concept of constant expressions. These are expressions such as <code>3+4</code>
 that will always yield the same results, at compile time and at run 
time. Constant expressions are optimization opportunities for compilers,
 and compilers frequently execute them at compile time and hardcode the 
results in the program. Also, there are a number of places where the C++
 specification requires the use of constant expressions. Defining an 
array requires a constant expression, and enumerator values must be 
constant expressions.</p>
<p>However, a constant expression has never been allowed to contain a 
function call or object constructor. So a piece of code as simple as 
this is illegal:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">int</span> get_five<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><span class="kw1">return</span> <span class="nu0">5</span><span class="sy4">;</span><span class="br0">}</span>
 
<span class="kw4">int</span> some_value<span class="br0">[</span>get_five<span class="br0">(</span><span class="br0">)</span> <span class="sy2">+</span> <span class="nu0">7</span><span class="br0">]</span><span class="sy4">;</span> <span class="co1">// Create an array of 12 integers. Ill-formed C++</span>
</pre></div>
</div>
<p>This was not legal in C++03, because <code>get_five() + 7</code> is not a constant expression. A C++03 compiler has no way of knowing if <code>get_five()</code>
 actually is constant at runtime. In theory, this function could affect a
 global variable, call other non-runtime constant functions, etc.</p>
<p>C++11 introduced the keyword <code>constexpr</code>, which allows the user to guarantee that a function or object constructor is a compile-time constant.<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span>[</span>8<span>]</span></a></sup> The above example can be rewritten as follows:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">constexpr <span class="kw4">int</span> get_five<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><span class="kw1">return</span> <span class="nu0">5</span><span class="sy4">;</span><span class="br0">}</span>
 
<span class="kw4">int</span> some_value<span class="br0">[</span>get_five<span class="br0">(</span><span class="br0">)</span> <span class="sy2">+</span> <span class="nu0">7</span><span class="br0">]</span><span class="sy4">;</span> <span class="co1">// Create an array of 12 integers. Legal C++11</span>
</pre></div>
</div>
<p>This allows the compiler to understand, and verify, that <code>get_five()</code> is a compile-time constant.</p>
<p>The use of <code>constexpr</code> on a function imposes some 
limitations on what that function can do. First, the function must have a
 non-void return type. Second, the function body cannot declare 
variables or define new types. Third, the body may contain only 
declarations, null statements and a single return statement. There must 
exist argument values such that, after argument substitution, the 
expression in the return statement produces a constant expression.</p>
<p>Prior to C++11, the values of variables could be used in constant 
expressions only if the variables are declared const, have an 
initializer which is a constant expression, and are of integral or 
enumeration type. C++11 removes the restriction that the variables must 
be of integral or enumeration type if they are defined with the <code>constexpr</code> keyword:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">constexpr <span class="kw4">double</span> earth_gravitational_acceleration <span class="sy1">=</span> <span class="nu16">9.8</span><span class="sy4">;</span>
constexpr <span class="kw4">double</span> moon_gravitational_acceleration <span class="sy1">=</span> earth_gravitational_acceleration <span class="sy2">/</span> <span class="nu16">6.0</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Such data variables are implicitly const, and must have an initializer which must be a constant expression.</p>
<p>In order to construct constant expression data values from user-defined types, constructors can also be declared with <code>constexpr</code>. A <code>constexpr</code>
 constructor's function body can contain only declarations and null 
statements, and cannot declare variables or define types, as with a <code>constexpr</code>
 function. There must exist argument values such that, after argument 
substitution, it initializes the class's members with constant 
expressions. The destructors for such types must be trivial.</p>
<p>The copy constructor for a type with any <code>constexpr</code> constructors should usually also be defined as a <code>constexpr</code>
 constructor, in order to allow objects of the type to be returned by 
value from a constexpr function. Any member function of a class, such as
 copy constructors, operator overloads, etc., can be declared as <code>constexpr</code>,
 so long as they meet the requirements for constexpr functions. This 
allows the compiler to copy classes at compile time, perform operations 
on them, etc.</p>
<p>If a constexpr function or constructor is called with arguments which
 aren't constant expressions, the call behaves as if the function were 
not constexpr, and the resulting value is not a constant expression. 
Likewise, if the expression in the return statement of a constexpr 
function does not evaluate to a constant expression for a particular 
invocation, the result is not a constant expression.</p>
<h4><span class="mw-headline" id="Modification_to_the_definition_of_plain_old_data">Modification to the definition of plain old data</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=6" title="Edit section: Modification to the definition of plain old data">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, a class or struct must follow a number of rules in order for it to be considered a <a href="http://en.wikipedia.org/wiki/Plain_Old_Data_Structures" title="Plain Old Data Structures" class="mw-redirect">plain old data</a>
 (POD) type. Types that fit this definition produce object layouts that 
are compatible with C, and they could also be initialized statically. 
The C++03 standard has restrictions on what types are compatible with C 
or can be statically initialized despite no technical reason a compiler 
couldn't accept the program; if someone were to create a C++03 POD type 
and add a non-virtual member function, this type would no longer be a 
POD type, could not be statically initialized, and would be incompatible
 with C despite no change to the memory layout.</p>
<p>C++11 relaxed several of the POD rules, by dividing the POD concept into two separate concepts: <i>trivial</i> and <i>standard-layout</i>.</p>
<p>A type that is <i>trivial</i> can be statically initialized. It also means that it is legal to copy data around via <code>memcpy</code>, rather than having to use a copy constructor. The lifetime of a <i>trivial</i> type begins when its storage is defined, not when a constructor completes.</p>
<p>A trivial class or struct is defined as one that:</p>
<ol>
<li>Has a trivial default constructor. This may use the <a href="#Explicitly_defaulted_and_deleted_special_member_functions">default constructor syntax</a> (<code>SomeConstructor() = default;</code>).</li>
<li>Has trivial copy and move constructors, which may use the default syntax.</li>
<li>Has trivial copy and move assignment operators, which may use the default syntax.</li>
<li>Has a trivial destructor, which must not be virtual.</li>
</ol>
<p>Constructors are trivial only if there are no virtual member 
functions of the class and no virtual base classes. Copy/move operations
 also require that all of the non-static data members be trivial.</p>
<p>A type that is <i>standard-layout</i> means that it orders and packs 
its members in a way that is compatible with C. A class or struct is 
standard-layout, by definition, provided:</p>
<ol>
<li>It has no virtual functions</li>
<li>It has no virtual base classes</li>
<li>All its non-static data members have the same access control (public, private, protected)</li>
<li>All its non-static data members, including any in its base classes, are in the same one class in the hierarchy</li>
<li>The above rules also apply to all the base classes and to all non-static data members in the class hierarchy</li>
<li>It has no base classes of the same type as the first defined non-static data member</li>
</ol>
<p>A class/struct/union is considered POD if it is trivial, 
standard-layout, and all of its non-static data members and base classes
 are PODs.</p>
<p>By separating these concepts, it becomes possible to give up one 
without losing the other. A class with complex move and copy 
constructors may not be trivial, but it could be standard-layout and 
thus interop with C. Similarly, a class with public and private 
non-static data members would not be standard-layout, but it could be 
trivial and thus <code>memcpy</code>-able.</p>
<h3><span class="mw-headline" id="Core_language_build_time_performance_enhancements">Core language build time performance enhancements</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=7" title="Edit section: Core language build time performance enhancements">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<h4><span class="mw-headline" id="Extern_template">Extern template</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=8" title="Edit section: Extern template">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, the compiler must instantiate a template whenever a fully 
specified template is encountered in a translation unit. If the template
 is instantiated with the same types in many translation units, this can
 dramatically increase compile times. There is no way to prevent this in
 C++03, so C++11 introduced extern template declarations, analogous to 
extern data declarations.</p>
<p>C++03 has this syntax to oblige the compiler to instantiate a template:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span> <span class="kw2">class</span> std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span>MyClass<span class="sy1">&gt;</span><span class="sy4">;</span>
</pre></div>
</div>
<p>C++11 now provides this syntax:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">extern</span> <span class="kw2">template</span> <span class="kw2">class</span> std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span>MyClass<span class="sy1">&gt;</span><span class="sy4">;</span>
</pre></div>
</div>
<p>which tells the compiler <i>not</i> to instantiate the template in this translation unit.</p>
<h3><span class="mw-headline" id="Core_language_usability_enhancements">Core language usability enhancements</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=9" title="Edit section: Core language usability enhancements">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>These features exist for the primary purpose of making the language 
easier to use. These can improve type safety, minimize code repetition, 
make erroneous code less likely, etc.</p>
<h4><span class="mw-headline" id="Initializer_lists">Initializer lists</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=10" title="Edit section: Initializer lists">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++03 inherited the initializer-list feature from C. A struct or 
array is given a list of arguments in braces, in the order of the 
members' definitions in the struct. These initializer-lists are 
recursive, so an array of structs or struct containing other structs can
 use them.</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> Object <span class="br0">{</span>
    <span class="kw4">float</span> first<span class="sy4">;</span>
    <span class="kw4">int</span> second<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
Object scalar <span class="sy1">=</span> <span class="br0">{</span><span class="nu17">0.43f</span>, <span class="nu0">10</span><span class="br0">}</span><span class="sy4">;</span> <span class="co1">//One Object, with first=0.43f and second=10</span>
Object anArray<span class="br0">[</span><span class="br0">]</span> <span class="sy1">=</span> <span class="br0">{</span><span class="br0">{</span><span class="nu17">13.4f</span>, <span class="nu0">3</span><span class="br0">}</span>, <span class="br0">{</span><span class="nu17">43.28f</span>, <span class="nu0">29</span><span class="br0">}</span>, <span class="br0">{</span><span class="nu17">5.934f</span>, <span class="nu0">17</span><span class="br0">}</span><span class="br0">}</span><span class="sy4">;</span> <span class="co1">//An array of three Objects</span>
</pre></div>
</div>
<p>This is very useful for static lists or just for initializing a 
struct to a particular value. C++ also provides constructors to 
initialize an object, but they are often not as convenient as the 
initializer list. However C++03 allows initializer-lists only on structs
 and classes that conform to the Plain Old Data (POD) definition; C++11 
extends initializer-lists, so they can be used for all classes including
 standard containers like <code>std::vector</code>.</p>
<p>C++11 binds the concept to a template, called <code>std::initializer_list</code>. This allows constructors and other functions to take initializer-lists as parameters. For example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">class</span> SequenceClass <span class="br0">{</span>
<span class="kw2">public</span><span class="sy4">:</span>
    SequenceClass<span class="br0">(</span>std<span class="sy4">::</span><span class="me2">initializer_list</span><span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span> list<span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>This allows <code>SequenceClass</code> to be constructed from a sequence of integers, as such:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">SequenceClass some_var <span class="sy1">=</span> <span class="br0">{</span><span class="nu0">1</span>, <span class="nu0">4</span>, <span class="nu0">5</span>, <span class="nu0">6</span><span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>This constructor is a special kind of constructor, called an 
initializer-list-constructor. Classes with such a constructor are 
treated specially during uniform initialization (see <a href="#Uniform_initialization">below</a>)</p>
<p>The class <code>std::initializer_list&lt;&gt;</code> is a <a href="http://en.wikipedia.org/wiki/First-class_citizen" title="First-class citizen">first-class</a>
 C++11 standard library type. However, they can be initially constructed
 statically by the C++11 compiler only through the use of the {} syntax.
 The list can be copied once constructed, though this is only a 
copy-by-reference. An initializer list is constant; its members cannot 
be changed once the initializer list is created, nor can the data in 
those members be changed.</p>
<p>Because initializer_list is a real type, it can be used in other 
places besides class constructors. Regular functions can take typed 
initializer lists as arguments. For example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">void</span> function_name<span class="br0">(</span>std<span class="sy4">::</span><span class="me2">initializer_list</span><span class="sy1">&lt;</span><span class="kw4">float</span><span class="sy1">&gt;</span> list<span class="br0">)</span><span class="sy4">;</span>
 
function_name<span class="br0">(</span><span class="br0">{</span><span class="nu17">1.0f</span>, <span class="sy2">-</span><span class="nu17">3.45f</span>, <span class="sy2">-</span><span class="nu17">0.4f</span><span class="br0">}</span><span class="br0">)</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Standard containers can also be initialized in the following ways:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span>std<span class="sy4">::</span><span class="me2">string</span><span class="sy1">&gt;</span> v <span class="sy1">=</span> <span class="br0">{</span> <span class="st0">"xyzzy"</span>, <span class="st0">"plugh"</span>, <span class="st0">"abracadabra"</span> <span class="br0">}</span><span class="sy4">;</span>
std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span>std<span class="sy4">::</span><span class="me2">string</span><span class="sy1">&gt;</span> v<span class="br0">(</span><span class="br0">{</span> <span class="st0">"xyzzy"</span>, <span class="st0">"plugh"</span>, <span class="st0">"abracadabra"</span> <span class="br0">}</span><span class="br0">)</span><span class="sy4">;</span>
std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span>std<span class="sy4">::</span><span class="me2">string</span><span class="sy1">&gt;</span> v<span class="br0">{</span> <span class="st0">"xyzzy"</span>, <span class="st0">"plugh"</span>, <span class="st0">"abracadabra"</span> <span class="br0">}</span><span class="sy4">;</span> <span class="co1">// see "Uniform initialization" below</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Uniform_initialization">Uniform initialization</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=11" title="Edit section: Uniform initialization">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++03 has a number of problems with initializing types. There are 
several ways to initialize types, and they do not all produce the same 
results when interchanged. The traditional constructor syntax, for 
example, can look like a function declaration, and steps must be taken 
to ensure that the compiler's <a href="http://en.wikipedia.org/wiki/Most_vexing_parse" title="Most vexing parse">most vexing parse</a> rule will not mistake it for such. Only aggregates and POD types can be initialized with aggregate initializers (using <code>SomeType var = {/*stuff*/};</code>).</p>
<p>C++11 provides a syntax that allows for fully uniform type 
initialization that works on any object. It expands on the initializer 
list syntax:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> BasicStruct <span class="br0">{</span>
    <span class="kw4">int</span> x<span class="sy4">;</span>
    <span class="kw4">double</span> y<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw4">struct</span> AltStruct <span class="br0">{</span>
    AltStruct<span class="br0">(</span><span class="kw4">int</span> x, <span class="kw4">double</span> y<span class="br0">)</span> <span class="sy4">:</span> x_<span class="br0">{</span>x<span class="br0">}</span>, y_<span class="br0">{</span>y<span class="br0">}</span> <span class="br0">{</span><span class="br0">}</span>
 
<span class="kw2">private</span><span class="sy4">:</span>
    <span class="kw4">int</span> x_<span class="sy4">;</span>
    <span class="kw4">double</span> y_<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
BasicStruct var1<span class="br0">{</span><span class="nu0">5</span>, <span class="nu16">3.2</span><span class="br0">}</span><span class="sy4">;</span>
AltStruct var2<span class="br0">{</span><span class="nu0">2</span>, <span class="nu16">4.3</span><span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>The initialization of <code>var1</code> behaves exactly as though it 
were aggregate-initialization. That is, each data member of an object, 
in turn, will be copy-initialized with the corresponding value from the 
initializer-list. Implicit type conversion will be used where necessary.
 If no conversion exists, or only a narrowing conversion exists, the 
program is ill-formed. The initialization of <code>var2</code> invokes the constructor.</p>
<p>One is also able to do the following:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> IdString <span class="br0">{</span>
    std<span class="sy4">::</span><span class="me2">string</span> name<span class="sy4">;</span>
    <span class="kw4">int</span> identifier<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
IdString get_string<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>
    <span class="kw1">return</span> <span class="br0">{</span><span class="st0">"foo"</span>, <span class="nu0">42</span><span class="br0">}</span><span class="sy4">;</span> <span class="co1">//Note the lack of explicit type.</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>Uniform initialization does not replace constructor syntax. There are
 still times when constructor syntax is required. If a class has an 
initializer list constructor (<code>TypeName(initializer_list&lt;SomeType&gt;);</code>),
 then it takes priority over other forms of construction, provided that 
the initializer list conforms to the sequence constructor's type. The 
C++11 version of <code>std::vector</code> has an initializer list constructor for its template type. This means that the following code:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span> the_vec<span class="br0">{</span><span class="nu0">4</span><span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>will call the initializer list constructor, not the constructor of <code>std::vector</code>
 that takes a single size parameter and creates the vector with that 
size. To access the latter constructor, the user will need to use the 
standard constructor syntax directly.</p>
<h4><span class="mw-headline" id="Type_inference">Type inference</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=12" title="Edit section: Type inference">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03 (and C), the type of a variable must be explicitly specified
 in order to use it. However, with the advent of template types and 
template metaprogramming techniques, the type of something, particularly
 the well-defined return value of a function, may not be easily 
expressed. Therefore, storing intermediates in variables is difficult, 
possibly requiring knowledge of the internals of a particular 
metaprogramming library.</p>
<p>C++11 allows this to be mitigated in two ways. First, the definition of a variable with an explicit initialization can use the <code>auto</code> keyword. This creates a variable of the specific type of the initializer:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">auto</span> some_strange_callable_type <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">bind</span><span class="br0">(</span><span class="sy3">&amp;</span>some_function, _2, _1, some_object<span class="br0">)</span><span class="sy4">;</span>
<span class="kw4">auto</span> other_variable <span class="sy1">=</span> <span class="nu0">5</span><span class="sy4">;</span>
</pre></div>
</div>
<p>The type of <code>some_strange_callable_type</code> is simply whatever the particular template function override of <code>std::bind</code>
 returns for those particular arguments. This type is easily determined 
procedurally by the compiler as part of its semantic analysis duties, 
but is not easy for the user to determine upon inspection.</p>
<p>The type of <code>other_variable</code> is also well-defined, but it is easier for the user to determine. It is an <code>int</code>, which is the same type as the integer literal.</p>
<p>Additionally, the keyword <code><a href="http://en.wikipedia.org/wiki/Decltype" title="Decltype">decltype</a></code> can be used to determine the type of an expression at compile-time. For example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">int</span> some_int<span class="sy4">;</span>
decltype<span class="br0">(</span>some_int<span class="br0">)</span> other_integer_variable <span class="sy1">=</span> <span class="nu0">5</span><span class="sy4">;</span>
</pre></div>
</div>
<p>This is more useful in conjunction with <code>auto</code>, since the type of an auto variable is known only to the compiler. However, <code>decltype</code> can also be very useful for expressions in code that makes heavy use of operator overloading and specialized types.</p>
<p><code>auto</code> is also useful for reducing the verbosity of the code. For instance, instead of writing</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw1">for</span> <span class="br0">(</span>std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">const_iterator</span> itr <span class="sy1">=</span> myvec.<span class="me1">cbegin</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> itr <span class="sy3">!</span><span class="sy1">=</span> myvec.<span class="me1">cend</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> <span class="sy2">++</span>itr<span class="br0">)</span>
</pre></div>
</div>
<p>the programmer can use the shorter</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw1">for</span> <span class="br0">(</span><span class="kw4">auto</span> itr <span class="sy1">=</span> myvec.<span class="me1">cbegin</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> itr <span class="sy3">!</span><span class="sy1">=</span> myvec.<span class="me1">cend</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> <span class="sy2">++</span>itr<span class="br0">)</span>
</pre></div>
</div>
<p>This difference grows as the programmer begins to nest containers, though in such cases <code>typedef</code>s are a good way to decrease the amount of code.</p>
<p>The type denoted by <code>decltype</code> can be different from the type deduced by <code>auto</code>.</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="co2">#include &lt;vector&gt;</span>
<span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>
    <span class="kw4">const</span> std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span> v<span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span><span class="sy4">;</span>
    <span class="kw4">auto</span> a <span class="sy1">=</span> v<span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span><span class="sy4">;</span>        <span class="co1">// a has type int</span>
    decltype<span class="br0">(</span>v<span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">)</span> b <span class="sy1">=</span> <span class="nu0">1</span><span class="sy4">;</span> <span class="co1">// b has type const int&amp;, the return type of</span>
                          <span class="co1">//   std::vector&lt;int&gt;::operator[](size_type) const</span>
    <span class="kw4">auto</span> c <span class="sy1">=</span> <span class="nu0">0</span><span class="sy4">;</span>           <span class="co1">// c has type int</span>
    <span class="kw4">auto</span> d <span class="sy1">=</span> c<span class="sy4">;</span>           <span class="co1">// d has type int</span>
    decltype<span class="br0">(</span>c<span class="br0">)</span> e<span class="sy4">;</span>        <span class="co1">// e has type int, the type of the entity named by c</span>
    decltype<span class="br0">(</span><span class="br0">(</span>c<span class="br0">)</span><span class="br0">)</span> f <span class="sy1">=</span> c<span class="sy4">;</span>  <span class="co1">// f has type int&amp;, because (c) is an lvalue</span>
    decltype<span class="br0">(</span><span class="nu0">0</span><span class="br0">)</span> g<span class="sy4">;</span>        <span class="co1">// g has type int, because 0 is an rvalue</span>
<span class="br0">}</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Range-based_for_loop">Range-based for loop</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=13" title="Edit section: Range-based for loop">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++11 extends the syntax of the <code>for</code> statement to allow for easy iteration over a range of elements:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">int</span> my_array<span class="br0">[</span><span class="nu0">5</span><span class="br0">]</span> <span class="sy1">=</span> <span class="br0">{</span><span class="nu0">1</span>, <span class="nu0">2</span>, <span class="nu0">3</span>, <span class="nu0">4</span>, <span class="nu0">5</span><span class="br0">}</span><span class="sy4">;</span>
<span class="co1">// double the value of each element in my_array:</span>
<span class="kw1">for</span> <span class="br0">(</span><span class="kw4">int</span> <span class="sy3">&amp;</span>x <span class="sy4">:</span> my_array<span class="br0">)</span> <span class="br0">{</span>
    x <span class="sy2">*</span><span class="sy1">=</span> <span class="nu0">2</span><span class="sy4">;</span>
<span class="br0">}</span>
<span class="co1">// similar but also using type inference for array elements</span>
<span class="kw1">for</span> <span class="br0">(</span><span class="kw4">auto</span> <span class="sy3">&amp;</span>x <span class="sy4">:</span> my_array<span class="br0">)</span> <span class="br0">{</span>
    x <span class="sy2">*</span><span class="sy1">=</span> <span class="nu0">2</span><span class="sy4">;</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>This form of <code>for</code>, called the “range-based for”, will 
iterate over each element in the list. It will work for C-style arrays, 
initializer lists, and any type that has <code>begin()</code> and <code>end()</code>
 functions defined for it that return iterators. All of the standard 
library containers that have begin/end pairs will work with the 
range-based for statement.</p>
<h4><span class="mw-headline" id="Lambda_functions_and_expressions">Lambda functions and expressions</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=14" title="Edit section: Lambda functions and expressions">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<div class="hatnote relarticle mainarticle">Main article: <a href="http://en.wikipedia.org/wiki/Anonymous_function#C.2B.2B_.28since_C.2B.2B11.29" title="Anonymous function">Anonymous function § C++ (since C++11)</a></div>
<p>C++11 provides the ability to create <a href="http://en.wikipedia.org/wiki/Anonymous_function" title="Anonymous function">anonymous functions</a>, called lambda functions.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span>[</span>9<span>]</span></a></sup> These are defined as follows:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="br0">[</span><span class="br0">]</span><span class="br0">(</span><span class="kw4">int</span> x, <span class="kw4">int</span> y<span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> x <span class="sy2">+</span> y<span class="sy4">;</span> <span class="br0">}</span>
</pre></div>
</div>
<p>The return type is implicit; it returns the type of the return expression (<code>decltype(x+y)</code>). The return type of a lambda can be omitted as long as all <code>return</code> expressions return the same type. A lambda can optionally be a <a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29" title="Closure (computer science)" class="mw-redirect">closure</a>.</p>
<h4><span class="mw-headline" id="Alternative_function_syntax"><span id="trailing-return-type"></span> Alternative function syntax</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=15" title="Edit section: Alternative function syntax">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p><a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">Standard C</a>
 function declaration syntax was perfectly adequate for the feature set 
of the C language. As C++ evolved from C, it kept the basic syntax and 
extended it where necessary. However, as C++ became more complicated, it
 exposed a number of limitations, particularly with regard to template 
function declarations. The following, for example, is not allowed in 
C++03:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> Lhs, <span class="kw2">class</span> Rhs<span class="sy1">&gt;</span>
  Ret adding_func<span class="br0">(</span><span class="kw4">const</span> Lhs <span class="sy3">&amp;</span>lhs, <span class="kw4">const</span> Rhs <span class="sy3">&amp;</span>rhs<span class="br0">)</span> <span class="br0">{</span><span class="kw1">return</span> lhs <span class="sy2">+</span> rhs<span class="sy4">;</span><span class="br0">}</span> <span class="co1">//Ret must be the type of lhs+rhs</span>
</pre></div>
</div>
<p>The type <code>Ret</code> is whatever the addition of types <code>Lhs</code> and <code>Rhs</code> will produce. Even with the aforementioned C++11 functionality of <code>decltype</code>, this is not possible:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> Lhs, <span class="kw2">class</span> Rhs<span class="sy1">&gt;</span>
  decltype<span class="br0">(</span>lhs<span class="sy2">+</span>rhs<span class="br0">)</span> adding_func<span class="br0">(</span><span class="kw4">const</span> Lhs <span class="sy3">&amp;</span>lhs, <span class="kw4">const</span> Rhs <span class="sy3">&amp;</span>rhs<span class="br0">)</span> <span class="br0">{</span><span class="kw1">return</span> lhs <span class="sy2">+</span> rhs<span class="sy4">;</span><span class="br0">}</span> <span class="co1">//Not legal C++11</span>
</pre></div>
</div>
<p>This is not legal C++ because <code>lhs</code> and <code>rhs</code> 
have not yet been defined; they will not be valid identifiers until 
after the parser has parsed the rest of the function prototype.</p>
<p>To work around this, C++11 introduced a new function declaration syntax, with a <i>trailing-return-type</i>:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> Lhs, <span class="kw2">class</span> Rhs<span class="sy1">&gt;</span>
  <span class="kw4">auto</span> adding_func<span class="br0">(</span><span class="kw4">const</span> Lhs <span class="sy3">&amp;</span>lhs, <span class="kw4">const</span> Rhs <span class="sy3">&amp;</span>rhs<span class="br0">)</span> <span class="sy2">-</span><span class="sy1">&gt;</span> decltype<span class="br0">(</span>lhs<span class="sy2">+</span>rhs<span class="br0">)</span> <span class="br0">{</span><span class="kw1">return</span> lhs <span class="sy2">+</span> rhs<span class="sy4">;</span><span class="br0">}</span>
</pre></div>
</div>
<p>This syntax can be used for more mundane function declarations and definitions:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> SomeStruct  <span class="br0">{</span>
    <span class="kw4">auto</span> func_name<span class="br0">(</span><span class="kw4">int</span> x, <span class="kw4">int</span> y<span class="br0">)</span> <span class="sy2">-</span><span class="sy1">&gt;</span> <span class="kw4">int</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw4">auto</span> SomeStruct<span class="sy4">::</span><span class="me2">func_name</span><span class="br0">(</span><span class="kw4">int</span> x, <span class="kw4">int</span> y<span class="br0">)</span> <span class="sy2">-</span><span class="sy1">&gt;</span> <span class="kw4">int</span> <span class="br0">{</span>
    <span class="kw1">return</span> x <span class="sy2">+</span> y<span class="sy4">;</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>The use of the keyword “auto” in this case means something different from its use in automatic type deduction.</p>
<h4><span class="mw-headline" id="Object_construction_improvement">Object construction improvement</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=16" title="Edit section: Object construction improvement">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, constructors of a class are not allowed to call other 
constructors of that class; each constructor must construct all of its 
class members itself or call a common member function, like these,</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">class</span> SomeType  <span class="br0">{</span>
    <span class="kw4">int</span> number<span class="sy4">;</span>
 
<span class="kw2">private</span><span class="sy4">:</span>
    <span class="kw4">void</span> Construct<span class="br0">(</span><span class="kw4">int</span> new_number<span class="br0">)</span> <span class="br0">{</span> number <span class="sy1">=</span> new_number<span class="sy4">;</span> <span class="br0">}</span>
<span class="kw2">public</span><span class="sy4">:</span>
    SomeType<span class="br0">(</span><span class="kw4">int</span> new_number<span class="br0">)</span> <span class="br0">{</span> Construct<span class="br0">(</span>new_number<span class="br0">)</span><span class="sy4">;</span> <span class="br0">}</span>
    SomeType<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> Construct<span class="br0">(</span><span class="nu0">42</span><span class="br0">)</span><span class="sy4">;</span> <span class="br0">}</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Constructors for base classes cannot be directly exposed to derived 
classes; each derived class must implement constructors even if a base 
class constructor would be appropriate. Non-constant data members of 
classes cannot be initialized at the site of the declaration of those 
members. They can be initialized only in a constructor.</p>
<p>C++11 provides solutions to all of these problems.</p>
<p>C++11 allows constructors to call other peer constructors (known as <a href="http://en.wikipedia.org/wiki/Delegation_%28programming%29" title="Delegation (programming)">delegation</a>).
 This allows constructors to utilize another constructor's behavior with
 a minimum of added code. Examples of other languages similar to C++ 
that provide delegation are <a href="http://en.wikipedia.org/wiki/Java_%28programming_language%29" title="Java (programming language)">Java</a>, <a href="http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29" title="C Sharp (programming language)">C#</a>, and <a href="http://en.wikipedia.org/wiki/D_%28programming_language%29" title="D (programming language)">D</a>.</p>
<p>This syntax is as follows:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">class</span> SomeType  <span class="br0">{</span>
    <span class="kw4">int</span> number<span class="sy4">;</span>
 
<span class="kw2">public</span><span class="sy4">:</span>
    SomeType<span class="br0">(</span><span class="kw4">int</span> new_number<span class="br0">)</span> <span class="sy4">:</span> number<span class="br0">(</span>new_number<span class="br0">)</span> <span class="br0">{</span><span class="br0">}</span>
    SomeType<span class="br0">(</span><span class="br0">)</span> <span class="sy4">:</span> SomeType<span class="br0">(</span><span class="nu0">42</span><span class="br0">)</span> <span class="br0">{</span><span class="br0">}</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Notice that, in this case, the same effect could have been achieved 
by making new_number a defaulting parameter. The new syntax, however, 
allows the default value (42) to be expressed in the implementation 
rather than the interface — a benefit to maintainers of library code 
since default values for function parameters are “baked in” to call 
sites, whereas constructor delegation allows the value to be changed 
without recompilation of the code using the library.</p>
<p>This comes with a caveat: C++03 considers an object to be constructed
 when its constructor finishes executing, but C++11 considers an object 
constructed once <i>any</i> constructor finishes execution. Since 
multiple constructors will be allowed to execute, this will mean that 
each delegating constructor will be executing on a fully constructed 
object of its own type. Derived class constructors will execute after 
all delegation in their base classes is complete.</p>
<p>For base-class constructors, C++11 allows a class to specify that 
base class constructors will be inherited. This means that the C++11 
compiler will generate code to perform the inheritance, the forwarding 
of the derived class to the base class. Note that this is an 
all-or-nothing feature; either all of that base class's constructors are
 forwarded or none of them are. Also, note that there are restrictions 
for multiple inheritance, such that class constructors cannot be 
inherited from two classes that use constructors with the same 
signature. Nor can a constructor in the derived class exist that matches
 a signature in the inherited base class.</p>
<p>The syntax is as follows:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">class</span> BaseClass <span class="br0">{</span>
<span class="kw2">public</span><span class="sy4">:</span>
    BaseClass<span class="br0">(</span><span class="kw4">int</span> value<span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw2">class</span> DerivedClass <span class="sy4">:</span> <span class="kw2">public</span> BaseClass <span class="br0">{</span>
<span class="kw2">public</span><span class="sy4">:</span>
    <span class="kw2">using</span> BaseClass<span class="sy4">::</span><span class="me2">BaseClass</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>For member initialization, C++11 allows the following syntax:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">class</span> SomeClass <span class="br0">{</span>
<span class="kw2">public</span><span class="sy4">:</span>
    SomeClass<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><span class="br0">}</span>
    <span class="kw2">explicit</span> SomeClass<span class="br0">(</span><span class="kw4">int</span> new_value<span class="br0">)</span> <span class="sy4">:</span> value<span class="br0">(</span>new_value<span class="br0">)</span> <span class="br0">{</span><span class="br0">}</span>
 
<span class="kw2">private</span><span class="sy4">:</span>
    <span class="kw4">int</span> value <span class="sy1">=</span> <span class="nu0">5</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Any constructor of the class will initialize <code>value</code> with 5, if the constructor does not override the initialization with its own. So the above empty constructor will initialize <code>value</code> as the class definition states, but the constructor that takes an int will initialize it to the given parameter.</p>
<p>It can also use constructor or uniform initialization, instead of the assignment initialization shown above.</p>
<h4><span class="mw-headline" id="Explicit_overrides_and_final">Explicit overrides and final</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=17" title="Edit section: Explicit overrides and final">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, it is possible to accidentally create a new virtual 
function, when one intended to override a base class function. For 
example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> Base <span class="br0">{</span>
    <span class="kw2">virtual</span> <span class="kw4">void</span> some_func<span class="br0">(</span><span class="kw4">float</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw4">struct</span> Derived <span class="sy4">:</span> Base <span class="br0">{</span>
    <span class="kw2">virtual</span> <span class="kw4">void</span> some_func<span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Suppose the <code>Derived::some_func</code> is intended to replace the base class version. But instead, because it has a different <a href="http://en.wikipedia.org/wiki/Type_signature" title="Type signature">signature</a>, it creates a second virtual function. This is a common problem, particularly when a user goes to modify the base class.</p>
<p>C++11 provides syntax to solve this problem.</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> Base <span class="br0">{</span>
    <span class="kw2">virtual</span> <span class="kw4">void</span> some_func<span class="br0">(</span><span class="kw4">float</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw4">struct</span> Derived <span class="sy4">:</span> Base <span class="br0">{</span>
    <span class="kw2">virtual</span> <span class="kw4">void</span> some_func<span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span> override<span class="sy4">;</span> <span class="co1">// ill-formed - doesn't override a base class method</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>The <code>override</code> special identifier means that the compiler 
will check the base class(es) to see if there is a virtual function with
 this exact signature. And if there is not, the compiler will indicate 
an error.</p>
<p>C++11 also adds the ability to prevent inheriting from classes or 
simply preventing overriding methods in derived classes. This is done 
with the special identifier <code>final</code>. For example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> Base1 final <span class="br0">{</span> <span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw4">struct</span> Derived1 <span class="sy4">:</span> Base1 <span class="br0">{</span> <span class="br0">}</span><span class="sy4">;</span> <span class="co1">// ill-formed because the class Base1 has been marked final</span>
</pre></div>
</div>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> Base2 <span class="br0">{</span>
    <span class="kw2">virtual</span> <span class="kw4">void</span> f<span class="br0">(</span><span class="br0">)</span> final<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw4">struct</span> Derived2 <span class="sy4">:</span> Base2 <span class="br0">{</span>
    <span class="kw4">void</span> f<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> <span class="co1">// ill-formed because the virtual function Base2::f has been marked final</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>In this example, the <code>virtual void f() final;</code> statement 
declares a new virtual function, but it also prevents derived classes 
from overriding it. It also has the effect of preventing derived classes
 from using that particular function name and parameter combination.</p>
<p>Note that neither <code>override</code> nor <code>final</code> are language keywords. They are technically identifiers for declarator attributes:</p>
<ul>
<li>they gain special meaning as attributes only when used in those 
specific trailing contexts (after all type specifiers, access 
specifiers, member declarations (for struct, class and enum types) and 
declarator specifiers, but before initialization or code implementation 
of each declarator in a comma-separated list of declarators);</li>
<li>they do not alter the declared type signature and do not declare or override any new identifier in any scope;</li>
<li>the recognized and accepted declarator attributes may be extended in
 future versions of C++ (some compiler-specific extensions already 
recognize additional declarator attributes, in order to provide code 
generation options or optimization hints to the compiler, or to generate
 additional data into the compiled code, intended for debuggers, 
linkers, and deployment of the compiled code, or to provide additional 
system-specific security attributes, or to enhance reflection 
capabilities at runtime, or to provide additional binding information 
for interoperability with other programming languages and runtime 
systems; these extensions may take parameters between parentheses after 
the declarator attribute identifier; for ANSI conformance, these 
compiler-specific extensions should use the double underscore prefix 
convention).</li>
<li>In any other location, they can be valid identifiers for new declarations (and later use if they are accessible).</li>
</ul>
<h4><span class="mw-headline" id="Null_pointer_constant">Null pointer constant</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=18" title="Edit section: Null pointer constant">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>For the purposes of this section and this section alone, every occurrence of “<code>0</code>” is meant as “a constant expression which evaluates to <code>0</code>, which is of type int”. In reality, the constant expression can be of any integral type.</p>
<p>Since the dawn of C in 1972, the constant <code><a href="http://en.wikipedia.org/wiki/0_%28number%29" title="0 (number)">0</a></code> has had the double role of constant integer and null pointer constant. The ambiguity inherent in the double meaning of <code>0</code> was dealt with in C by the use of the preprocessor macro <code>NULL</code>, which commonly expands to either <code>((void*)0)</code> or <code>0</code>. C++ didn't adopt the same behavior, allowing only <code>0</code> as a null pointer constant. This interacts poorly with function overloading:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">void</span> foo<span class="br0">(</span><span class="kw4">char</span> <span class="sy2">*</span><span class="br0">)</span><span class="sy4">;</span>
<span class="kw4">void</span> foo<span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span><span class="sy4">;</span>
</pre></div>
</div>
<p>If <code>NULL</code> is defined as <code>0</code> (which is usually the case in C++), the statement <code>foo(NULL);</code> will call <code>foo(int)</code>, which is almost certainly not what the programmer intended, and not what a superficial reading of the code suggests.</p>
<p>C++11 corrects this by introducing a new keyword to serve as a distinguished null pointer constant: <code>nullptr</code>. It is of type <code>nullptr_t</code>,
 which is implicitly convertible and comparable to any pointer type or 
pointer-to-member type. It is not implicitly convertible or comparable 
to integral types, except for <code>bool</code>. While the original proposal specified that an rvalue of type <code>nullptr</code> should not be convertible to <code>bool</code>,
 the core language working group decided that such a conversion would be
 desirable, for consistency with regular pointer types. The proposed 
wording changes were unanimously voted into the Working Paper in June 
2008.<sup class="reference plainlinks nourlexpansion" id="ref_n2697"><a class="external autonumber" href="http://en.wikipedia.org/wiki/C%2B%2B11#endnote_n2697">[2]</a></sup></p>
<p>For backwards compatibility reasons, <code>0</code> remains a valid null pointer constant.</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">char</span> <span class="sy2">*</span>pc <span class="sy1">=</span> nullptr<span class="sy4">;</span>     <span class="co1">// OK</span>
<span class="kw4">int</span>  <span class="sy2">*</span>pi <span class="sy1">=</span> nullptr<span class="sy4">;</span>     <span class="co1">// OK</span>
<span class="kw4">bool</span>   b <span class="sy1">=</span> nullptr<span class="sy4">;</span>     <span class="co1">// OK. b is false.</span>
<span class="kw4">int</span>    i <span class="sy1">=</span> nullptr<span class="sy4">;</span>     <span class="co1">// error</span>
 
foo<span class="br0">(</span>nullptr<span class="br0">)</span><span class="sy4">;</span>           <span class="co1">// calls foo(nullptr_t), not foo(int);</span>
<span class="coMULTI">/*
  Note that foo(nullptr_t) will actually call foo(char *) in the example above using an implicit conversion,
  only if there are no other functions overloading with compatible pointer types in scope.
  If there are multiple overloadings, the resolution will fail as it is ambiguous,
  unless there is an explicit declaration of foo(nullptr_t).
 
  In standard types headers for C++11, the nullptr_t  type should be declared as:
      typedef decltype(nullptr) nullptr_t;
  but not as:
      typedef int nullptr_t; // previous versions of C++ which require NULL being defined as 0
      typedef void *nullptr_t; // ANSI C which defines NULL as ((void*)0)
*/</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Strongly_typed_enumerations">Strongly typed enumerations</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=19" title="Edit section: Strongly typed enumerations">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, enumerations are not type-safe. They are effectively 
integers, even when the enumeration types are distinct. This allows the 
comparison between two enum values of different enumeration types. The 
only safety that C++03 provides is that an integer or a value of one 
enum type does not convert implicitly to another enum type. 
Additionally, the underlying integral type is implementation-defined; 
code that depends on the size of the enumeration is therefore 
non-portable. Lastly, enumeration values are scoped to the enclosing 
scope. Thus, it is not possible for two separate enumerations to have 
matching member names.</p>
<p>C++11 allows a special classification of enumeration that has none of these issues. This is expressed using the <code>enum class</code> (<code>enum struct</code> is also accepted as a synonym) declaration:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">enum</span> <span class="kw2">class</span> Enumeration <span class="br0">{</span>
    Val1,
    Val2,
    Val3 <span class="sy1">=</span> <span class="nu0">100</span>,
    Val4 <span class="co1">// = 101</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>This enumeration is type-safe. Enum class values are not implicitly 
converted to integers; therefore, they cannot be compared to integers 
either (the expression <code>Enumeration::Val4 == 101</code> gives a compiler error).</p>
<p>The underlying type of enum classes is always known. The default type is <code>int</code>; this can be overridden to a different integral type as can be seen in the following example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">enum</span> <span class="kw2">class</span> Enum2 <span class="sy4">:</span> <span class="kw4">unsigned</span> <span class="kw4">int</span> <span class="br0">{</span>Val1, Val2<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>With old-style enumerations the values are placed in the outer scope.
 With new-style enumerations they are placed within the scope of the 
enum class name. So in the above example, <code>Val1</code> is undefined, but <code>Enum2::Val1</code> is defined.</p>
<p>There is also a transitional syntax to allow old-style enumerations 
to provide explicit scoping as well as the definition of the underlying 
type:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">enum</span> Enum3 <span class="sy4">:</span> <span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="br0">{</span>Val1 <span class="sy1">=</span> <span class="nu0">1</span>, Val2<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>In this case the enumerator names are defined in the enumeration's scope (<code>Enum3::Val1</code>), but for backwards compatibility they are also placed in the enclosing scope.</p>
<p>Forward-declaring enums are also possible in C++11. Previously, enum 
types could not be forward-declared because the size of the enumeration 
depends on the definition of its members. As long as the size of the 
enumeration is specified either implicitly or explicitly, it can be 
forward-declared:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">enum</span> Enum1<span class="sy4">;</span>                      <span class="co1">// Illegal in C++03 and C++11; the underlying type cannot be determined.</span>
<span class="kw2">enum</span> Enum2 <span class="sy4">:</span> <span class="kw4">unsigned</span> <span class="kw4">int</span><span class="sy4">;</span>       <span class="co1">// Legal in C++11, the underlying type is explicitly specified.</span>
<span class="kw2">enum</span> <span class="kw2">class</span> Enum3<span class="sy4">;</span>                <span class="co1">// Legal in C++11, the underlying type is int.</span>
<span class="kw2">enum</span> <span class="kw2">class</span> Enum4 <span class="sy4">:</span> <span class="kw4">unsigned</span> <span class="kw4">int</span><span class="sy4">;</span> <span class="co1">// Legal in C++11.</span>
<span class="kw2">enum</span> Enum2 <span class="sy4">:</span> <span class="kw4">unsigned</span> <span class="kw4">short</span><span class="sy4">;</span>     <span class="co1">// Illegal in C++11, because Enum2 was previously declared with a different underlying type.</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Right_angle_bracket">Right angle bracket</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=20" title="Edit section: Right angle bracket">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++03's parser defines “<code>&gt;&gt;</code>” as the right shift 
operator in all cases. However, with nested template declarations, there
 is a tendency for the programmer to neglect to place a space between 
the two right angle brackets, thus causing a compiler syntax error.</p>
<p>C++11 improves the specification of the parser so that multiple right
 angle brackets will be interpreted as closing the template argument 
list where it is reasonable. This can be overridden by using parentheses
 around parameter expressions using the “<code>&gt;</code>”, “<code>&gt;=</code>” or “<code>&gt;&gt;</code>” binary operators:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw4">bool</span> Test<span class="sy1">&gt;</span> <span class="kw2">class</span> SomeType<span class="sy4">;</span>
std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span>SomeType<span class="sy1">&lt;</span><span class="nu0">1</span><span class="sy1">&gt;</span><span class="nu0">2</span><span class="sy1">&gt;&gt;</span> x1<span class="sy4">;</span>  <span class="co1">// Interpreted as a std::vector of SomeType&lt;true&gt;,</span>
    <span class="co1">// followed by "2 &gt;&gt; x1", which is not legal syntax for a declarator. 1 is true.</span>
std<span class="sy4">::</span><span class="me2">vector</span><span class="sy1">&lt;</span>SomeType<span class="sy1">&lt;</span><span class="br0">(</span><span class="nu0">1</span><span class="sy1">&gt;</span><span class="nu0">2</span><span class="br0">)</span><span class="sy1">&gt;&gt;</span> x1<span class="sy4">;</span>  <span class="co1">// Interpreted as std::vector of SomeType&lt;false&gt;,</span>
    <span class="co1">// followed by the declarator "x1", which is legal C++11 syntax. (1&gt;2) is false.</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Explicit_conversion_operators">Explicit conversion operators</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=21" title="Edit section: Explicit conversion operators">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++98 added the <code>explicit</code> keyword as a modifier on 
constructors to prevent single-argument constructors from being used as 
implicit type conversion operators. However, this does nothing for 
actual conversion operators. For example, a smart pointer class may have
 an <code>operator bool()</code> to allow it to act more like a primitive pointer: if it includes this conversion, it can be tested with <code>if (smart_ptr_variable)</code>
 (which would be true if the pointer was non-null and false otherwise). 
However, this allows other, unintended conversions as well. Because C++ <code>bool</code>
 is defined as an arithmetic type, it can be implicitly converted to 
integral or even floating-point types, which allows for mathematical 
operations that are not intended by the user.</p>
<p>In C++11, the <code>explicit</code> keyword can now be applied to 
conversion operators. As with constructors, it prevents the use of those
 conversion functions in implicit conversions. However, language 
contexts that specifically require a boolean value (the conditions of 
if-statements and loops, as well as operands to the logical operators) 
count as explicit conversions and can thus use a bool conversion 
operator.</p>
<p>For example, this feature solves in a clean way the <a href="http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Safe_bool" class="extiw" title="b:More C++ Idioms/Safe bool">safe bool</a> issue.</p>
<h4><span class="mw-headline" id="Alias_templates">Alias templates</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=22" title="Edit section: Alias templates">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, it is possible to define a typedef only as a synonym for 
another type, including a synonym for a template specialization with all
 actual template arguments specified. It is not possible to create a 
typedef template. For example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span> <span class="sy1">&lt;</span><span class="kw2">typename</span> First, <span class="kw2">typename</span> Second, <span class="kw4">int</span> Third<span class="sy1">&gt;</span>
<span class="kw2">class</span> SomeType<span class="sy4">;</span>
 
<span class="kw2">template</span> <span class="sy1">&lt;</span><span class="kw2">typename</span> Second<span class="sy1">&gt;</span>
<span class="kw4">typedef</span> SomeType<span class="sy1">&lt;</span>OtherType, Second, <span class="nu0">5</span><span class="sy1">&gt;</span> TypedefName<span class="sy4">;</span> <span class="co1">// Illegal in C++03</span>
</pre></div>
</div>
<p>This will not compile.</p>
<p>C++11 adds this ability with the following syntax:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span> <span class="sy1">&lt;</span><span class="kw2">typename</span> First, <span class="kw2">typename</span> Second, <span class="kw4">int</span> Third<span class="sy1">&gt;</span>
<span class="kw2">class</span> SomeType<span class="sy4">;</span>
 
<span class="kw2">template</span> <span class="sy1">&lt;</span><span class="kw2">typename</span> Second<span class="sy1">&gt;</span>
<span class="kw2">using</span> TypedefName <span class="sy1">=</span> SomeType<span class="sy1">&lt;</span>OtherType, Second, <span class="nu0">5</span><span class="sy1">&gt;</span><span class="sy4">;</span>
</pre></div>
</div>
<p>The <code>using</code> syntax can be also used as type aliasing in C++11:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">typedef</span> <span class="kw4">void</span> <span class="br0">(</span><span class="sy2">*</span>FunctionType<span class="br0">)</span><span class="br0">(</span><span class="kw4">double</span><span class="br0">)</span><span class="sy4">;</span>       <span class="co1">// Old style</span>
<span class="kw2">using</span> FunctionType <span class="sy1">=</span> <span class="kw4">void</span> <span class="br0">(</span><span class="sy2">*</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">double</span><span class="br0">)</span><span class="sy4">;</span> <span class="co1">// New introduced syntax</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Unrestricted_unions">Unrestricted unions</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=23" title="Edit section: Unrestricted unions">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, there are restrictions on what types of objects can be members of a <code>union</code>. For example, unions cannot contain any objects that define a non-trivial constructor. C++11 lifts some of these restrictions.<sup class="reference plainlinks nourlexpansion" id="ref_n2544"><a class="external autonumber" href="http://en.wikipedia.org/wiki/C%2B%2B11#endnote_n2544">[3]</a></sup></p>
<ul>
<li>Unions can now contain objects that have a non-trivial constructor.</li>
<li>If so, the implicit default constructor of the union is deleted, forcing a manual definition.</li>
</ul>
<p>This is a simple example of a union permitted in C++11:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="co2">#include &lt;new&gt; // Required for placement 'new'.</span>
 
<span class="kw4">struct</span> Point <span class="br0">{</span>
    Point<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><span class="br0">}</span>
    Point<span class="br0">(</span><span class="kw4">int</span> x, <span class="kw4">int</span> y<span class="br0">)</span><span class="sy4">:</span> x_<span class="br0">(</span>x<span class="br0">)</span>, y_<span class="br0">(</span>y<span class="br0">)</span> <span class="br0">{</span><span class="br0">}</span>
    <span class="kw4">int</span> x_, y_<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw4">union</span> U <span class="br0">{</span>
    <span class="kw4">int</span> z<span class="sy4">;</span>
    <span class="kw4">double</span> w<span class="sy4">;</span>
    Point p<span class="sy4">;</span> <span class="co1">// Illegal in C++03; legal in C++11.</span>
    U<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span><span class="kw3">new</span><span class="br0">(</span><span class="sy3">&amp;</span>p<span class="br0">)</span> Point<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span><span class="br0">}</span> <span class="co1">// Due to the Point member, a constructor definition is now required.</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>The changes will not break any existing code since they only relax current rules.</p>
<h3><span class="mw-headline" id="Core_language_functionality_improvements">Core language functionality improvements</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=24" title="Edit section: Core language functionality improvements">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>These features allow the language to do things that were previously 
impossible, exceedingly verbose, or required non-portable libraries.</p>
<h4><span class="mw-headline" id="Variadic_templates">Variadic templates</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=25" title="Edit section: Variadic templates">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<div class="hatnote relarticle mainarticle">Main article: <a href="http://en.wikipedia.org/wiki/Variadic_templates" title="Variadic templates" class="mw-redirect">variadic templates</a></div>
<p>In C++11, templates can take variable numbers of template parameters. This also allows the definition of type-safe <a href="http://en.wikipedia.org/wiki/Variadic_function" title="Variadic function">variadic functions</a>.</p>
<h4><span class="mw-headline" id="New_string_literals">New string literals</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=26" title="Edit section: New string literals">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++03 offers two kinds of <a href="http://en.wikipedia.org/wiki/String_literal" title="String literal">string literals</a>. The first kind, contained within double quotes, produces a null-terminated array of type <code>const char</code>. The second kind, defined as <code>L""</code>, produces a null-terminated array of type <code>const wchar_t</code>, where <code>wchar_t</code> is a wide-character of undefined size and semantics. Neither literal type offers support for string literals with <a href="http://en.wikipedia.org/wiki/UTF-8" title="UTF-8">UTF-8</a>, <a href="http://en.wikipedia.org/wiki/UTF-16" title="UTF-16">UTF-16</a>, or any other kind of <a href="http://en.wikipedia.org/wiki/Unicode" title="Unicode">Unicode</a> <a href="http://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings" title="Comparison of Unicode encodings">encodings</a>.</p>
<p>The definition of the type <code>char</code> has been modified to explicitly express that it's at least the size necessary to store an eight-bit coding of <a href="http://en.wikipedia.org/wiki/UTF-8" title="UTF-8">UTF-8</a>,
 and large enough to contain any member of the compiler's basic 
execution character set. It was previously defined as only the latter in
 the C++ standard itself, then relying on the C standard to guarantee at
 least 8 bits.</p>
<p>There are three Unicode encodings that C++11 supports: <a href="http://en.wikipedia.org/wiki/UTF-8" title="UTF-8">UTF-8</a>, <a href="http://en.wikipedia.org/wiki/UTF-16" title="UTF-16">UTF-16</a>, and <a href="http://en.wikipedia.org/wiki/UTF-32" title="UTF-32">UTF-32</a>. In addition to the previously noted changes to the definition of <code>char</code>, C++11 adds two new character types: <code>char16_t</code> and <code>char32_t</code>. These are designed to store UTF-16 and UTF-32 respectively.</p>
<p>The following shows how to create string literals for each of these encodings:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">u8<span class="st0">"I'm a UTF-8 string."</span>
u<span class="st0">"This is a UTF-16 string."</span>
U<span class="st0">"This is a UTF-32 string."</span>
</pre></div>
</div>
<p>The type of the first string is the usual <code>const char[]</code>. The type of the second string is <code>const char16_t[]</code>. The type of the third string is <code>const char32_t[]</code>.</p>
<p>When building Unicode string literals, it is often useful to insert 
Unicode codepoints directly into the string. To do this, C++11 allows 
the following syntax:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">u8<span class="st0">"This is a Unicode Character: <span class="es3">\u2018</span>."</span>
u<span class="st0">"This is a bigger Unicode Character: <span class="es3">\u2018</span>."</span>
U<span class="st0">"This is a Unicode Character: <span class="es4">\U00002018</span>."</span>
</pre></div>
</div>
<p>The number after the <code>\u</code> is a hexadecimal number; it does not need the usual <code>0x</code> prefix. The identifier <code>\u</code> represents a 16-bit Unicode codepoint; to enter a 32-bit codepoint, use <code>\U</code>
 and a 32-bit hexadecimal number. Only valid Unicode codepoints can be 
entered. For example, codepoints on the range U+D800–U+DFFF are 
forbidden, as they are reserved for surrogate pairs in UTF-16 encodings.</p>
<p>It is also sometimes useful to avoid escaping strings manually, particularly for using literals of <a href="http://en.wikipedia.org/wiki/XML" title="XML">XML</a> files, scripting languages, or regular expressions. C++11 provides a raw string literal:</p>
<pre>R"(The String Data \ Stuff " )"
R"delimiter(The String Data \ Stuff " )delimiter"
</pre>
<p>In the first case, everything between the <code>"(</code> and the <code>)"</code> is part of the string. The <code>"</code> and <code>\</code> characters do not need to be escaped. In the second case, the <code>"delimiter(</code> starts the string, and it ends only when <code>)delimiter"</code> is reached. The string <code>delimiter</code>
 can be any string up to 16 characters in length, including the empty 
string. This string cannot contain spaces, control characters, '<code>(</code>', '<code>)</code>', or the '<code>\</code>' character. The use of this delimiter string allows the user to have "<code>)</code>" characters within raw string literals. For example, <code>R"delimiter((a-z))delimiter"</code> is equivalent to <code>"(a-z)"</code>.<sup class="reference plainlinks nourlexpansion" id="ref_n3000"><a class="external autonumber" href="http://en.wikipedia.org/wiki/C%2B%2B11#endnote_n3000">[4]</a></sup></p>
<p>Raw string literals can be combined with the wide literal or any of the Unicode literal prefixes:</p>
<pre>u8R"XXX(I'm a "raw UTF-8" string.)XXX"
uR"*(This is a "raw UTF-16" string.)*"
UR"(This is a "raw UTF-32" string.)"
</pre>
<h4><span class="mw-headline" id="User-defined_literals">User-defined literals</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=27" title="Edit section: User-defined literals">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++03 provides a number of literals. The characters “<code>12.5</code>” are a literal that is resolved by the compiler as a type <code>double</code> with the value of 12.5. However, the addition of the suffix “<code>f</code>”, as in “<code>12.5f</code>”, creates a value of type <code>float</code>
 that contains the value 12.5. The suffix modifiers for literals are 
fixed by the C++ specification, and C++ code cannot create new literal 
modifiers.</p>
<p>C++11 also includes the ability for the user to define new kinds of 
literal modifiers that will construct objects based on the string of 
characters that the literal modifies.</p>
<p>Literals transformation is redefined into two distinct phases: raw 
and cooked. A raw literal is a sequence of characters of some specific 
type, while the cooked literal is of a separate type. The C++ literal <code>1234</code>, as a raw literal, is this sequence of characters <code>'1'</code>, <code>'2'</code>, <code>'3'</code>, <code>'4'</code>. As a cooked literal, it is the integer 1234. The C++ literal <code>0xA</code> in raw form is <code>'0'</code>, <code>'x'</code>, <code>'A'</code>, while in cooked form it is the integer 10.</p>
<p>Literals can be extended in both raw and cooked forms, with the 
exception of string literals, which can be processed only in cooked 
form. This exception is due to the fact that strings have prefixes that 
affect the specific meaning and type of the characters in question.</p>
<p>All user-defined literals are suffixes; defining prefix literals is 
not possible. All suffixes beginning with any character except 
underscore (<code>_</code>) are reserved by the standard. Therefore, all user-defined literals have suffixes beginning with an underscore (<code>_</code>).</p>
<p>User-defined literals processing the raw form of the literal are defined as follows:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">OutputType operator <span class="st0">""</span> _suffix<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">char</span> <span class="sy2">*</span> literal_string<span class="br0">)</span><span class="sy4">;</span>
 
OutputType some_variable <span class="sy1">=</span> <span class="nu0">1234</span>_suffix<span class="sy4">;</span>
</pre></div>
</div>
<p>The second statement executes the code defined by the user-defined literal function. This function is passed <code>"1234"</code> as a C-style string, so it has a null terminator.</p>
<p>An alternative mechanism for processing integer and floating point raw literals is through a <a href="http://en.wikipedia.org/wiki/Variadic_template" title="Variadic template">variadic template</a>:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw4">char</span>...<span class="sy1">&gt;</span> OutputType operator <span class="st0">""</span> _tuffix<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
 
OutputType some_variable <span class="sy1">=</span> <span class="nu0">1234</span>_tuffix<span class="sy4">;</span>
OutputType another_variable <span class="sy1">=</span> <span class="nu16">2.17</span>_tuffix<span class="sy4">;</span>
</pre></div>
</div>
<p>This instantiates the literal processing function as <code>operator "" _tuffix&lt;'1', '2', '3', '4'&gt;()</code>. In this form, there is no terminating null character to the string. The main purpose for doing this is to use C++11's <code>constexpr</code> keyword and the compiler to allow the literal to be transformed entirely at compile time, assuming <code>OutputType</code> is a constexpr-constructable and copyable type, and the literal processing function is a <code>constexpr</code> function.</p>
<p>For numeric literals, the type of the cooked literal is either <code>unsigned long long</code> for integral literals or <code>long double</code>
 for floating point literals. (Note: There is no need for signed 
integral types because a sign-prefixed literal is parsed as an 
expression containing the sign as a unary prefix operator and the 
unsigned number.) There is no alternative template form:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">OutputType operator <span class="st0">""</span> _suffix<span class="br0">(</span><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">long</span><span class="br0">)</span><span class="sy4">;</span>
OutputType operator <span class="st0">""</span> _suffix<span class="br0">(</span><span class="kw4">long</span> <span class="kw4">double</span><span class="br0">)</span><span class="sy4">;</span>
 
OutputType some_variable <span class="sy1">=</span> <span class="nu0">1234</span>_suffix<span class="sy4">;</span> <span class="co1">// Uses the 'unsigned long long' overload.</span>
OutputType another_variable <span class="sy1">=</span> <span class="nu16">3.1416</span>_suffix<span class="sy4">;</span> <span class="co1">// Uses the 'long double' overload.</span>
</pre></div>
</div>
<p>For string literals, the following are used, in accordance with the previously mentioned new string prefixes:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">OutputType operator <span class="st0">""</span> _ssuffix<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">char</span>     <span class="sy2">*</span> string_values, <span class="kw4">size_t</span> num_chars<span class="br0">)</span><span class="sy4">;</span>
OutputType operator <span class="st0">""</span> _ssuffix<span class="br0">(</span><span class="kw4">const</span> <span class="kw4">wchar_t</span>  <span class="sy2">*</span> string_values, <span class="kw4">size_t</span> num_chars<span class="br0">)</span><span class="sy4">;</span>
OutputType operator <span class="st0">""</span> _ssuffix<span class="br0">(</span><span class="kw4">const</span> char16_t <span class="sy2">*</span> string_values, <span class="kw4">size_t</span> num_chars<span class="br0">)</span><span class="sy4">;</span>
OutputType operator <span class="st0">""</span> _ssuffix<span class="br0">(</span><span class="kw4">const</span> char32_t <span class="sy2">*</span> string_values, <span class="kw4">size_t</span> num_chars<span class="br0">)</span><span class="sy4">;</span>
 
OutputType some_variable <span class="sy1">=</span>   <span class="st0">"1234"</span>_ssuffix<span class="sy4">;</span> <span class="co1">// Uses the 'const char *' overload.</span>
OutputType some_variable <span class="sy1">=</span> u8<span class="st0">"1234"</span>_ssuffix<span class="sy4">;</span> <span class="co1">// Uses the 'const char *' overload.</span>
OutputType some_variable <span class="sy1">=</span>  L<span class="st0">"1234"</span>_ssuffix<span class="sy4">;</span> <span class="co1">// Uses the 'const wchar_t *'  overload.</span>
OutputType some_variable <span class="sy1">=</span>  u<span class="st0">"1234"</span>_ssuffix<span class="sy4">;</span> <span class="co1">// Uses the 'const char16_t *' overload.</span>
OutputType some_variable <span class="sy1">=</span>  U<span class="st0">"1234"</span>_ssuffix<span class="sy4">;</span> <span class="co1">// Uses the 'const char32_t *' overload.</span>
</pre></div>
</div>
<p>There is no alternative template form. Character literals are defined similarly.</p>
<h4><span class="mw-headline" id="Multithreading_memory_model">Multithreading memory model</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=28" title="Edit section: Multithreading memory model">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<div class="hatnote boilerplate seealso">See also: <a href="http://en.wikipedia.org/wiki/Memory_model_%28computing%29" title="Memory model (computing)" class="mw-redirect">Memory model (computing)</a></div>
<p>The C++11 standardizes support for <a href="http://en.wikipedia.org/wiki/Thread_%28computer_science%29" title="Thread (computer science)" class="mw-redirect">multithreaded programming</a>.</p>
<p>There are two parts involved: a memory model which allows multiple 
threads to co-exist in a program and library support for interaction 
between threads. (See this article's section on <a href="#Threading_facilities">threading facilities</a>.)</p>
<p>The memory model defines when multiple threads may access the same 
memory location, and specifies when updates by one thread become visible
 to other threads.</p>
<h4><span class="mw-headline" id="Thread-local_storage">Thread-local storage</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=29" title="Edit section: Thread-local storage">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In a multi-threaded environment, it is common for every thread to have some unique <a href="http://en.wikipedia.org/wiki/Variable_%28programming%29" title="Variable (programming)" class="mw-redirect">variables</a>. This already happens for the local variables of a function, but it does not happen for global and static variables.</p>
<p>A new <a href="http://en.wikipedia.org/wiki/Thread-Local_Storage" title="Thread-Local Storage" class="mw-redirect"><i>thread-local</i></a> storage duration (in addition to the existing <i>static</i>, <i>dynamic</i> and <i>automatic</i>) is indicated by the storage specifier <code>thread_local</code>.</p>
<p>Any object which could have static storage duration (i.e., lifetime 
spanning the entire execution of the program) may be given thread-local 
duration instead. The intent is that like any other static-duration 
variable, a thread-local object can be initialized using a constructor 
and destroyed using a destructor.</p>
<h4><span class="mw-headline" id="Explicitly_defaulted_and_deleted_special_member_functions">Explicitly defaulted and deleted special member functions</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=30" title="Edit section: Explicitly defaulted and deleted special member functions">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, the compiler provides, for classes that do not provide them
 for themselves, a default constructor, a copy constructor, a copy 
assignment operator (<code>operator=</code>), and a destructor. The 
programmer can override these defaults by defining custom versions. C++ 
also defines several global operators (such as <code>operator new</code>) that work on all classes, which the programmer can override.</p>
<p>However, there is very little control over the creation of these 
defaults. Making a class inherently non-copyable, for example, requires 
declaring a private copy constructor and copy assignment operator and 
not defining them. Attempting to use these functions is a violation of 
the <a href="http://en.wikipedia.org/wiki/One_Definition_Rule" title="One Definition Rule">One Definition Rule</a> (ODR). While a diagnostic message is not required,<sup id="cite_ref-C.2B.2B03_3.2.2F3_10-0" class="reference"><a href="#cite_note-C.2B.2B03_3.2.2F3-10"><span>[</span>10<span>]</span></a></sup> violations may result in a linker error.</p>
<p>In the case of the default constructor, the compiler will not generate a default constructor if a class is defined with <i>any</i>
 constructors. This is useful in many cases, but it is also useful to be
 able to have both specialized constructors and the compiler-generated 
default.</p>
<p>C++11 allows the explicit defaulting and deleting of these special member functions.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span>[</span>11<span>]</span></a></sup> For example, the following type explicitly declares that it is using the default constructor:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> SomeType <span class="br0">{</span>
    SomeType<span class="br0">(</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span> <span class="co1">//The default constructor is explicitly stated.</span>
    SomeType<span class="br0">(</span>OtherType value<span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Alternatively, certain features can be explicitly disabled. For example, the following type is non-copyable:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> NonCopyable <span class="br0">{</span>
    NonCopyable<span class="br0">(</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw1">default</span><span class="sy4">;</span>
    NonCopyable<span class="br0">(</span><span class="kw4">const</span> NonCopyable<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw3">delete</span><span class="sy4">;</span>
    NonCopyable <span class="sy3">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span><span class="kw4">const</span> NonCopyable<span class="sy3">&amp;</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw3">delete</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>The <code>= delete</code> specifier can be used to prohibit calling 
any function, which can be used to disallow calling a member function 
with particular parameters. For example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> NoInt <span class="br0">{</span>
    <span class="kw4">void</span> f<span class="br0">(</span><span class="kw4">double</span> i<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw4">void</span> f<span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span> <span class="sy1">=</span> <span class="kw3">delete</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>An attempt to call <code>f()</code> with an <code>int</code> will be rejected by the compiler, instead of performing a silent conversion to <code>double</code>. This can be generalized to disallow calling the function with any type other than <code>double</code> as follows:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> OnlyDouble <span class="br0">{</span>
    <span class="kw4">void</span> f<span class="br0">(</span><span class="kw4">double</span> d<span class="br0">)</span><span class="sy4">;</span>
    <span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> T<span class="sy1">&gt;</span> <span class="kw4">void</span> f<span class="br0">(</span>T<span class="br0">)</span> <span class="sy1">=</span> <span class="kw3">delete</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Type_long_long_int">Type <code>long long int</code></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=31" title="Edit section: Type long long int">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, the largest integer type is <code>long int</code>. It is guaranteed to have at least as many usable bits as <code>int</code>. This resulted in <code>long int</code> having size of 64 bits on some popular implementations and 32 bits on others. C++11 adds a new integer type <code>long long int</code> to address this issue. It is guaranteed to be at least as large as a <code>long int</code>, and have no fewer than 64 bits. The type was originally introduced by <a href="http://en.wikipedia.org/wiki/C99" title="C99">C99</a> to the standard C, and most C++ compilers support it as an extension already.<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span>[</span>12<span>]</span></a></sup><sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span>[</span>13<span>]</span></a></sup></p>
<h4><span class="mw-headline" id="Static_assertions">Static assertions</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=32" title="Edit section: Static assertions">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++03 provides two methods to test <a href="http://en.wikipedia.org/wiki/Assertion_%28computing%29" title="Assertion (computing)" class="mw-redirect">assertions</a>: the macro <code>assert</code> and the preprocessor directive <code>#error</code>.
 However, neither is appropriate for use in templates: the macro tests 
the assertion at execution-time, while the preprocessor directive tests 
the assertion during preprocessing, which happens before instantiation 
of templates. Neither is appropriate for testing properties that are 
dependent on template parameters.</p>
<p>The new utility introduces a new way to test assertions at compile-time, using the new keyword <code>static_assert</code>. The declaration assumes the following form:</p>
<pre>static_assert (<i>constant-expression</i>, <i>error-message</i>);
</pre>
<p>Here are some examples of how <code>static_assert</code> can be used:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">static_assert<span class="br0">(</span><span class="br0">(</span>GREEKPI <span class="sy1">&gt;</span> <span class="nu16">3.14</span><span class="br0">)</span> <span class="sy3">&amp;&amp;</span> <span class="br0">(</span>GREEKPI <span class="sy1">&lt;</span> <span class="nu16">3.15</span><span class="br0">)</span>, <span class="st0">"GREEKPI is inaccurate!"</span><span class="br0">)</span><span class="sy4">;</span>
</pre></div>
</div>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> T<span class="sy1">&gt;</span>
<span class="kw4">struct</span> Check  <span class="br0">{</span>
    static_assert<span class="br0">(</span><span class="kw3">sizeof</span><span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span> <span class="sy1">&lt;=</span> <span class="kw3">sizeof</span><span class="br0">(</span>T<span class="br0">)</span>, <span class="st0">"T is not big enough!"</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> Integral<span class="sy1">&gt;</span>
Integral foo<span class="br0">(</span>Integral x, Integral y<span class="br0">)</span> <span class="br0">{</span>
    static_assert<span class="br0">(</span>std<span class="sy4">::</span><span class="me2">is_integral</span><span class="sy1">&lt;</span>Integral<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">value</span>, <span class="st0">"foo() parameter must be an integral type."</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>When the constant expression is <code>false</code> the compiler produces an error message. The first example is similar to the preprocessor directive <code>#error</code>, although the preprocessor does only support integral types.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span>[</span>14<span>]</span></a></sup> In contrast, in the second example the assertion is checked at every instantiation of the template class <code>Check</code>.</p>
<p>Static assertions are useful outside of templates as well. For 
instance, a particular implementation of an algorithm might depend on 
the size of a <code>long long</code> being larger than an <code>int</code>, something the standard does not guarantee. Such an assumption is valid on most systems and compilers, but not all.</p>
<h4><span class="mw-headline" id="Allow_sizeof_to_work_on_members_of_classes_without_an_explicit_object">Allow <code>sizeof</code> to work on members of classes without an explicit object</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=33" title="Edit section: Allow sizeof to work on members of classes without an explicit object">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>In C++03, the <code>sizeof</code> operator can be used on types and objects. But it cannot be used to do the following:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> SomeType <span class="br0">{</span> OtherType member<span class="sy4">;</span> <span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw3">sizeof</span><span class="br0">(</span>SomeType<span class="sy4">::</span><span class="me2">member</span><span class="br0">)</span><span class="sy4">;</span> <span class="co1">// Does not work with C++03. Okay with C++11</span>
</pre></div>
</div>
<p>This should return the size of <code>OtherType</code>. C++03 does not
 allow this, so it is a compile error. C++11 does allow it. It is also 
allowed for the alignof operator introduced in C++11.</p>
<h4><span class="mw-headline" id="Control_and_query_object_alignment">Control and query object alignment</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=34" title="Edit section: Control and query object alignment">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++11 allows variable alignment to be queried and controlled with <code>alignof</code> and <code>alignas</code>.</p>
<p>The <code>alignof</code> operator takes a type and returns the power of 2 byte boundary on which the type instances must be allocated (as a <code>std::size_t</code>). When given a reference type <code>alignof</code> returns the referenced type's alignment; for arrays it returns the element type's alignment.</p>
<p>The <code>alignas</code> specifier controls the memory alignment for a variable. The specifier takes a constant or a type; when supplied a type <code>alignas(T)</code> is shorthand for <code>alignas(alignof(T))</code>. For example, to specify that a char array should be properly aligned to hold a float:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">alignas<span class="br0">(</span><span class="kw4">float</span><span class="br0">)</span> <span class="kw4">unsigned</span> <span class="kw4">char</span> c<span class="br0">[</span><span class="kw3">sizeof</span><span class="br0">(</span><span class="kw4">float</span><span class="br0">)</span><span class="br0">]</span>
</pre></div>
</div>
<h4><span class="mw-headline" id="Allow_garbage_collected_implementations">Allow garbage collected implementations</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=35" title="Edit section: Allow garbage collected implementations">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>Previous C++ standards provided for programmer-driven garbage collection via <code>set_new_handler</code>,
 but gave no definition of object reachability for the purpose of 
automatic garbage collection. C++11 defines conditions under which 
pointer values are "safely derived" from other values. An implementation
 may specify that it operates under "strict pointer safety," in which 
case pointers that are not derived according to these rules can become 
invalid.</p>
<h4><span class="mw-headline" id="Attributes">Attributes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=36" title="Edit section: Attributes">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
<p>C++11 provides a standardized syntax for compiler/tool extensions to 
the language. Such extensions were traditionally specified using <code>#pragma</code> directive or vendor-specific keywords (like <code>__attribute__</code> for GNU and <code>__declspec</code>
 for Microsoft). With the new syntax, additional information can be 
specified in a form of an attribute enclosed in double square brackets. 
An attribute can be applied to various elements of source code:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">int</span> <span class="br0">[</span><span class="br0">[</span>attr1<span class="br0">]</span><span class="br0">]</span> i <span class="br0">[</span><span class="br0">[</span>attr2, attr3<span class="br0">]</span><span class="br0">]</span><span class="sy4">;</span>
 
<span class="br0">[</span><span class="br0">[</span>attr4<span class="br0">(</span>arg1, arg2<span class="br0">)</span><span class="br0">]</span><span class="br0">]</span> <span class="kw1">if</span> <span class="br0">(</span>cond<span class="br0">)</span>
<span class="br0">{</span>
    <span class="br0">[</span><span class="br0">[</span>vendor<span class="sy4">::</span><span class="me2">attr5</span><span class="br0">]</span><span class="br0">]</span> <span class="kw1">return</span> i<span class="sy4">;</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>In the example above, attribute <code>attr1</code> applies to the type of variable <code>i</code>, <code>attr2</code> and <code>attr3</code> apply to the variable itself, <code>attr4</code> applies to the <code>if</code> statement and <code>vendor::attr5</code>
 applies to the return statement. In general (but with some exceptions),
 an attribute specified for a named entity is placed after the name, and
 before the entity otherwise. As shown above, several attributes may be 
listed inside one pair of double square brackets, additional arguments 
may be provided for an attribute and attributes may be scoped by 
vendor-specific attribute namespaces.</p>
<p>It is recommended that attributes do not have any language semantic 
meaning and don't change the sense of a program when ignored. Attributes
 can be useful for providing information that, for example, helps the 
compiler to issue better diagnostics or optimize the generated code.</p>
<p>C++11 provides two standard attributes itself: <code>noreturn</code> to specify that a function does not return, and <code>carries_dependency</code> to help optimizing multi-threaded code by indicating that function arguments or return value carry a dependency.</p>
<h2><span class="mw-headline" id="C.2B.2B_standard_library_changes">C++ standard library changes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=37" title="Edit section: C++ standard library changes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>A number of new features were introduced in the C++11 standard 
library. Many of these could have been implemented under the old 
standard, but some rely (to a greater or lesser extent) on new C++11 
core features.</p>
<p>A large part of the new <a href="http://en.wikipedia.org/wiki/Library_%28computer_science%29" title="Library (computer science)" class="mw-redirect">libraries</a> was defined in the document <i><a href="http://en.wikipedia.org/wiki/Technical_Report_1" title="Technical Report 1" class="mw-redirect">C++ Standards Committee's Library Technical Report</a></i>
 (called TR1), which was published in 2005. Various full and partial 
implementations of TR1 are currently available using the namespace <code>std::tr1</code>. For C++11 they were moved to namespace <code>std</code>.
 However, as TR1 features were brought into the C++11 standard library, 
they were upgraded where appropriate with C++11 language features that 
were not available in the initial TR1 version. Also, they may have been 
enhanced with features that were possible under C++03, but were not part
 of the original TR1 specification.</p>
<p>The committee intends to create a second technical report (called 
TR2) now that standardization of C++11 is complete. Library proposals 
which were not ready in time for C++11 will be put into TR2 or further 
technical reports.</p>
<h3><span class="mw-headline" id="Upgrades_to_standard_library_components">Upgrades to standard library components</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=38" title="Edit section: Upgrades to standard library components">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>C++11 offers a number of new language features that the currently 
existing standard library components can benefit from. For example, most
 standard library containers can benefit from Rvalue reference based 
move constructor support, both for quickly moving heavy containers 
around and for moving the contents of those containers to new memory 
locations. The standard library components were upgraded with new C++11 
language features where appropriate. These include, but are not 
necessarily limited to:</p>
<ul>
<li>Rvalue references and the associated move support</li>
<li>Support for the UTF-16 encoding unit, and UTF-32 encoding unit Unicode character types</li>
<li><a href="http://en.wikipedia.org/wiki/Variadic_templates" title="Variadic templates" class="mw-redirect">Variadic templates</a> (coupled with Rvalue references to allow for perfect forwarding)</li>
<li>Compile-time constant expressions</li>
<li><code><a href="http://en.wikipedia.org/wiki/Decltype" title="Decltype">decltype</a></code></li>
<li><code>explicit</code> conversion operators</li>
<li><code>default</code>/<code>delete</code>d functions</li>
</ul>
<p>Additionally, much time has passed since the previous C++ standard. A
 great deal of code using the standard library has been written; this 
has revealed portions of the standard libraries that could use some 
improvement. Among the many areas of improvement considered were 
standard library <a href="http://en.wikipedia.org/wiki/Allocator_%28C%2B%2B%29" title="Allocator (C++)">allocators</a>. A new scope-based model of allocators was included in C++11 to supplement the previous model.</p>
<h3><span class="mw-headline" id="Threading_facilities">Threading facilities</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=39" title="Edit section: Threading facilities">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>While the C++03 language provides a memory model that supports 
threading, the primary support for actually using threading comes with 
the C++11 standard library.</p>
<p>A thread class (<code>std::thread</code>) is provided which takes a <a href="http://en.wikipedia.org/wiki/Function_object" title="Function object">function object</a>
 — and an optional series of arguments to pass to it — to run in the new
 thread. It is possible to cause a thread to halt until another 
executing thread completes, providing thread joining support through the
 <code>std::thread::join()</code> member function. Access is provided, where feasible, to the underlying native thread object(s) for <a href="http://en.wikipedia.org/wiki/Platform_%28computing%29" title="Platform (computing)" class="mw-redirect">platform</a> specific operations by the <code>std::thread::native_handle()</code> member function.</p>
<p>For synchronization between threads, appropriate <a href="http://en.wikipedia.org/wiki/Mutual_exclusion" title="Mutual exclusion">mutexes</a> (<code>std::mutex</code>, <code>std::recursive_mutex</code>, etc.) and <a href="http://en.wikipedia.org/wiki/Monitor_%28synchronization%29" title="Monitor (synchronization)">condition variables</a> (<code>std::condition_variable</code> and <code>std::condition_variable_any</code>) are added to the library. These are accessible through <a href="http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization" title="Resource Acquisition Is Initialization">RAII</a> locks (<code>std::lock_guard</code> and <code>std::unique_lock</code>) and locking algorithms for easy use.</p>
<p>For high-performance, low-level work, it is sometimes necessary to 
communicate between threads without the overhead of mutexes. This is 
achieved using <a href="http://en.wikipedia.org/wiki/Atomic_operation" title="Atomic operation" class="mw-redirect">atomic operations</a>
 on memory locations. These can optionally specify the minimum memory 
visibility constraints required for an operation. Explicit <a href="http://en.wikipedia.org/wiki/Memory_barrier" title="Memory barrier">memory barriers</a> may also be used for this purpose.</p>
<p>The C++11 thread library also includes <a href="http://en.wikipedia.org/wiki/Futures_and_promises" title="Futures and promises">futures and promises</a> for passing asynchronous results between threads, and <code>std::packaged_task</code>
 for wrapping up a function call that can generate such an asynchronous 
result. The futures proposal was criticized because it lacks a way to 
combine futures and check for the completion of one promise inside a set
 of promises.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span>[</span>15<span>]</span></a></sup></p>
<p>Further high-level threading facilities such as <a href="http://en.wikipedia.org/wiki/Thread_pool" title="Thread pool" class="mw-redirect">thread pools</a> have been remanded to a future C++ <a href="http://en.wikipedia.org/wiki/Technical_Report_1" title="Technical Report 1" class="mw-redirect">technical report</a>.
 They are not part of C++11, but their eventual implementation is 
expected to be built entirely on top of the thread library features.</p>
<p>The new <code>std::async</code> facility provides a convenient method of running tasks and tying them to a <code>std::future</code>.
 The user can choose whether the task is to be run asynchronously on a 
separate thread or synchronously on a thread that waits for the value. 
By default, the implementation can choose, which provides an easy way to
 take advantage of hardware concurrency without oversubscription, and 
provides some of the advantages of a thread pool for simple usages.</p>
<h3><span class="mw-headline" id="Tuple_types">Tuple types</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=40" title="Edit section: Tuple types">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p><a href="http://en.wikipedia.org/wiki/Tuple" title="Tuple">Tuples</a>
 are collections composed of heterogeneous objects of pre-arranged 
dimensions. A tuple can be considered a generalization of a struct's 
member variables.</p>
<p>The C++11 version of the TR1 tuple type benefited from C++11 features like <a href="#Variadic_templates">variadic templates</a>.
 The TR1 version required an implementation-defined maximum number of 
contained types, and required substantial macro trickery to implement 
reasonably. By contrast, the implementation of the C++11 version 
requires no explicit implementation-defined maximum number of types. 
Though compilers will have an internal maximum recursion depth for 
template instantiation (which is normal), the C++11 version of tuples 
will not expose this value to the user.</p>
<p>Using <a href="http://en.wikipedia.org/wiki/Variadic_templates" title="Variadic templates" class="mw-redirect">variadic templates</a>, the declaration of the tuple class looks as follows:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span> <span class="sy1">&lt;</span><span class="kw2">class</span> ...<span class="me1">Types</span><span class="sy1">&gt;</span> <span class="kw2">class</span> tuple<span class="sy4">;</span>
</pre></div>
</div>
<p>An example of definition and use of the tuple type:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">typedef</span> std<span class="sy4">::</span><span class="me2">tuple</span> <span class="sy1">&lt;</span><span class="kw4">int</span>, <span class="kw4">double</span>, <span class="kw4">long</span> <span class="sy3">&amp;</span>, <span class="kw4">const</span> <span class="kw4">char</span> <span class="sy2">*</span><span class="sy1">&gt;</span> test_tuple<span class="sy4">;</span>
<span class="kw4">long</span> lengthy <span class="sy1">=</span> <span class="nu0">12</span><span class="sy4">;</span>
test_tuple proof <span class="br0">(</span><span class="nu0">18</span>, <span class="nu16">6.5</span>, lengthy, <span class="st0">"Ciao!"</span><span class="br0">)</span><span class="sy4">;</span>
 
lengthy <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">get</span><span class="sy1">&lt;</span><span class="nu0">0</span><span class="sy1">&gt;</span><span class="br0">(</span>proof<span class="br0">)</span><span class="sy4">;</span>  <span class="co1">// Assign to 'lengthy' the value 18.</span>
std<span class="sy4">::</span><span class="me2">get</span><span class="sy1">&lt;</span><span class="nu0">3</span><span class="sy1">&gt;</span><span class="br0">(</span>proof<span class="br0">)</span> <span class="sy1">=</span> <span class="st0">" Beautiful!"</span><span class="sy4">;</span>  <span class="co1">// Modify the tuple’s fourth element.</span>
</pre></div>
</div>
<p>It’s possible to create the tuple <code>proof</code> without defining
 its contents, but only if the tuple elements' types possess default 
constructors. Moreover, it’s possible to assign a tuple to another 
tuple: if the two tuples’ types are the same, it is necessary that each 
element type possesses a copy constructor; otherwise, it is necessary 
that each element type of the right-side tuple is convertible to that of
 the corresponding element type of the left-side tuple or that the 
corresponding element type of the left-side tuple has a suitable 
constructor.</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">typedef</span> std<span class="sy4">::</span><span class="me2">tuple</span> <span class="sy1">&lt;</span><span class="kw4">int</span> , <span class="kw4">double</span>, string       <span class="sy1">&gt;</span> tuple_1 t1<span class="sy4">;</span>
<span class="kw4">typedef</span> std<span class="sy4">::</span><span class="me2">tuple</span> <span class="sy1">&lt;</span><span class="kw4">char</span>, <span class="kw4">short</span> , <span class="kw4">const</span> <span class="kw4">char</span> <span class="sy2">*</span> <span class="sy1">&gt;</span> tuple_2 t2 <span class="br0">(</span><span class="st0">'X'</span>, <span class="nu0">2</span>, <span class="st0">"Hola!"</span><span class="br0">)</span><span class="sy4">;</span>
t1 <span class="sy1">=</span> t2<span class="sy4">;</span> <span class="co1">// Ok, first two elements can be converted,</span>
         <span class="co1">// the third one can be constructed from a 'const char *'.</span>
</pre></div>
</div>
<p>Just like <code>std::make_pair</code> for <code>std::pair</code>, there exists <code>std::make_tuple</code> to automatically create <code>std::tuple</code>s using type deduction and <code>auto</code> helps to declare such a tuple. <code>std::tie</code> creates tuples of lvalue references to help unpack tuples. <code>std::ignore</code> also helps here. See the example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">auto</span> record <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">make_tuple</span><span class="br0">(</span><span class="st0">"Hari Ram"</span>, <span class="st0">"New Delhi"</span>, <span class="nu16">3.5</span>, <span class="st0">'A'</span><span class="br0">)</span><span class="sy4">;</span>
std<span class="sy4">::</span><span class="me2">string</span> name <span class="sy4">;</span> <span class="kw4">float</span> gpa <span class="sy4">;</span> <span class="kw4">char</span> grade <span class="sy4">;</span>
std<span class="sy4">::</span><span class="me2">tie</span><span class="br0">(</span>name, std<span class="sy4">::</span><span class="me2">ignore</span>, gpa, grade<span class="br0">)</span> <span class="sy1">=</span> record <span class="sy4">;</span> <span class="co1">// std::ignore helps drop the place name</span>
std<span class="sy4">::</span><span class="kw3">cout</span> <span class="sy1">&lt;&lt;</span> name <span class="sy1">&lt;&lt;</span> <span class="st0">' '</span> <span class="sy1">&lt;&lt;</span> gpa <span class="sy1">&lt;&lt;</span> <span class="st0">' '</span> <span class="sy1">&lt;&lt;</span> grade <span class="sy1">&lt;&lt;</span> std<span class="sy4">::</span><span class="me2">endl</span> <span class="sy4">;</span>
</pre></div>
</div>
<p>Relational operators are available (among tuples with the same number
 of elements), and two expressions are available to check a tuple’s 
characteristics (only during compilation):</p>
<ul>
<li><code>std::tuple_size&lt;T&gt;::value</code> returns the number of elements in the tuple <code>T</code>,</li>
<li><code>std::tuple_element&lt;I, T&gt;::type</code> returns the type of the object number <code>I</code> of the tuple <code>T</code>.</li>
</ul>
<h3><span class="mw-headline" id="Hash_tables">Hash tables</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=41" title="Edit section: Hash tables">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>Including <a href="http://en.wikipedia.org/wiki/Hash_table" title="Hash table">hash tables</a>
 (unordered associative containers) in the C++ standard library is one 
of the most recurring requests. It was not adopted in C++03 due to time 
constraints only. Although hash tables are less efficient than a 
balanced tree in the worst case (in the presence of many collisions), 
they perform better in many real applications.</p>
<p>Collisions are managed only through <i><a href="http://en.wikipedia.org/wiki/Hash_tables#Separate_chaining" title="Hash tables" class="mw-redirect">linear chaining</a></i> because the committee didn't consider it to be opportune to standardize solutions of <i><a href="http://en.wikipedia.org/wiki/Open_addressing" title="Open addressing">open addressing</a></i>
 that introduce quite a lot of intrinsic problems (above all when 
erasure of elements is admitted). To avoid name clashes with 
non-standard libraries that developed their own hash table 
implementations, the prefix “unordered” was used instead of “hash”.</p>
<p>The new library has four types of hash tables, differentiated by 
whether or not they accept elements with the same key (unique keys or 
equivalent keys), and whether they map each key to an associated value. 
They correspond to the four existing binary-search-tree-based 
associative containers, with an <tt>unordered_</tt> prefix.</p>
<table class="wikitable" style="text-align: center">
<tbody><tr>
<th>Type of hash table</th>
<th>Associated values</th>
<th>Equivalent keys</th>
</tr>
<tr>
<td style="text-align: left"><code><a href="http://en.wikipedia.org/wiki/Unordered_associative_containers_%28C%2B%2B%29" title="Unordered associative containers (C++)">std::unordered_set</a></code></td>
<td style="background:#F99;vertical-align:middle;text-align:center;" class="table-no">No</td>
<td style="background:#F99;vertical-align:middle;text-align:center;" class="table-no">No</td>
</tr>
<tr>
<td style="text-align: left"><code><a href="http://en.wikipedia.org/wiki/Unordered_associative_containers_%28C%2B%2B%29" title="Unordered associative containers (C++)">std::unordered_multiset</a></code></td>
<td style="background:#F99;vertical-align:middle;text-align:center;" class="table-no">No</td>
<td style="background:#9F9;vertical-align:middle;text-align:center;" class="table-yes">Yes</td>
</tr>
<tr>
<td style="text-align: left"><code><a href="http://en.wikipedia.org/wiki/Unordered_associative_containers_%28C%2B%2B%29" title="Unordered associative containers (C++)">std::unordered_map</a></code></td>
<td style="background:#9F9;vertical-align:middle;text-align:center;" class="table-yes">Yes</td>
<td style="background:#F99;vertical-align:middle;text-align:center;" class="table-no">No</td>
</tr>
<tr>
<td style="text-align: left"><code><a href="http://en.wikipedia.org/wiki/Unordered_associative_containers_%28C%2B%2B%29" title="Unordered associative containers (C++)">std::unordered_multimap</a></code></td>
<td style="background:#9F9;vertical-align:middle;text-align:center;" class="table-yes">Yes</td>
<td style="background:#9F9;vertical-align:middle;text-align:center;" class="table-yes">Yes</td>
</tr>
</tbody></table>
<p>The new classes fulfill all the requirements of a <a href="http://en.wikipedia.org/wiki/Standard_Template_Library#Containers" title="Standard Template Library">container class</a>, and have all the methods necessary to access elements: <code>insert</code>, <code>erase</code>, <code>begin</code>, <code>end</code>.</p>
<p>This new feature didn't need any C++ language core extensions (though
 implementations will take advantage of various C++11 language 
features), only a small extension of the header <code>&lt;functional&gt;</code> and the introduction of headers <code>&lt;unordered_set&gt;</code> and <code>&lt;unordered_map&gt;</code>.
 No other changes to any existing standard classes were needed, and it 
doesn’t depend on any other extensions of the standard library.</p>
<h3><span class="mw-headline" id="Regular_expressions">Regular expressions</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=42" title="Edit section: Regular expressions">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>The new library, defined in the new header <code>&lt;regex&gt;</code>, is made of a couple of new classes:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Regular_expression" title="Regular expression">regular expressions</a> are represented by instance of the template class <code>std::regex</code>;</li>
<li>occurrences are represented by instance of the template class <code>std::match_results</code>.</li>
</ul>
<p>The function <code>std::regex_search</code> is used for searching, while for ‘search and replace’ the function <code>std::regex_replace</code> is used which returns a new string. The algorithms <code>std::regex_search</code> and <code>std::regex_replace</code> take a regular expression and a string and write the occurrences found in the struct <code>std::match_results</code>.</p>
<p>Here is an example of the use of <code>std::match_results</code>:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">const</span> <span class="kw4">char</span> <span class="sy2">*</span>reg_esp <span class="sy1">=</span> <span class="st0">"[ ,.<span class="es1">\\</span>t<span class="es1">\\</span>n;:]"</span><span class="sy4">;</span>  <span class="co1">// List of separator characters.</span>
 
<span class="co1">// this can be done using raw string literals:</span>
<span class="co1">// const char *reg_esp = R"([ ,.\t\n;:])";</span>
 
std<span class="sy4">::</span><span class="me2">regex</span> rgx<span class="br0">(</span>reg_esp<span class="br0">)</span><span class="sy4">;</span> <span class="co1">// 'regex' is an instance of the template class</span>
                         <span class="co1">// 'basic_regex' with argument of type 'char'.</span>
std<span class="sy4">::</span><span class="me2">cmatch</span> match<span class="sy4">;</span> <span class="co1">// 'cmatch' is an instance of the template class</span>
                   <span class="co1">// 'match_results' with argument of type 'const char *'.</span>
<span class="kw4">const</span> <span class="kw4">char</span> <span class="sy2">*</span>target <span class="sy1">=</span> <span class="st0">"Unseen University - Ankh-Morpork"</span><span class="sy4">;</span>
 
<span class="co1">// Identifies all words of 'target' separated by characters of 'reg_esp'.</span>
<span class="kw1">if</span> <span class="br0">(</span>std<span class="sy4">::</span><span class="me2">regex_search</span><span class="br0">(</span>target, match, rgx<span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span>
    <span class="co1">// If words separated by specified characters are present.</span>
 
    <span class="kw4">const</span> <span class="kw4">size_t</span> n <span class="sy1">=</span> match.<span class="me1">size</span><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
    <span class="kw1">for</span> <span class="br0">(</span><span class="kw4">size_t</span> a <span class="sy1">=</span> <span class="nu0">0</span><span class="sy4">;</span> a <span class="sy1">&lt;</span> n<span class="sy4">;</span> a<span class="sy2">++</span><span class="br0">)</span> <span class="br0">{</span>
        std<span class="sy4">::</span><span class="me2">string</span> str <span class="br0">(</span>match<span class="br0">[</span>a<span class="br0">]</span>.<span class="me1">first</span>, match<span class="br0">[</span>a<span class="br0">]</span>.<span class="me1">second</span><span class="br0">)</span><span class="sy4">;</span>
        std<span class="sy4">::</span><span class="kw3">cout</span> <span class="sy1">&lt;&lt;</span> str <span class="sy1">&lt;&lt;</span> <span class="st0">"<span class="es1">\n</span>"</span><span class="sy4">;</span>
    <span class="br0">}</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>Note the use of double <a href="http://en.wikipedia.org/wiki/Backslash" title="Backslash">backslashes</a>, because C++ uses backslash as an escape character. The C++11 <a href="#New_string_literals">raw string</a> feature could be used to avoid the problem.</p>
<p>The library <code>&lt;regex&gt;</code> requires neither alteration of
 any existing header (though it will use them where appropriate) nor an 
extension of the core language.</p>
<h3><span class="mw-headline" id="General-purpose_smart_pointers">General-purpose smart pointers</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=43" title="Edit section: General-purpose smart pointers">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<div class="hatnote relarticle mainarticle">Main article: <a href="http://en.wikipedia.org/wiki/Smart_pointer#C.2B.2B_smart_pointers" title="Smart pointer">C++ Smart Pointers</a></div>
<p>C++11 provides <code><span class="mw-geshi text source-text">std::unique_ptr</span></code>, as well as improvements to <code><span class="mw-geshi text source-text">std::shared_ptr</span></code> and <code><span class="mw-geshi text source-text">std::weak_ptr</span></code> from TR1. <code><span class="mw-geshi text source-text">std::auto_ptr</span></code> is deprecated.</p>
<h3><span class="mw-headline" id="Extensible_random_number_facility">Extensible random number facility</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=44" title="Edit section: Extensible random number facility">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>The C standard library provides the ability to generate <a href="http://en.wikipedia.org/wiki/Pseudorandom_number" title="Pseudorandom number" class="mw-redirect">pseudorandom numbers</a> through the function <code>rand</code>.
 However, the algorithm is delegated entirely to the library vendor. C++
 inherited this functionality with no changes, but C++11 provides a new 
method for generating pseudorandom numbers.</p>
<p>C++11's random number functionality is split into two parts: a 
generator engine that contains the random number generator's state and 
produces the pseudorandom numbers; and a distribution, which determines 
the range and <a href="http://en.wikipedia.org/wiki/Distribution_%28mathematics%29" title="Distribution (mathematics)">mathematical distribution</a> of the outcome. These two are combined to form a random number generator object.</p>
<p>Unlike the C standard <code>rand</code>, the C++11 mechanism will come with three base generator engine algorithms:</p>
<ul>
<li><code><a href="http://en.wikipedia.org/wiki/Linear_congruential_generator" title="Linear congruential generator">linear_congruential_engine</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Subtract_with_carry" title="Subtract with carry">subtract_with_carry_engine</a></code>, and</li>
<li><code><a href="http://en.wikipedia.org/wiki/Mersenne_twister" title="Mersenne twister">mersenne_twister_engine</a></code>.</li>
</ul>
<p>C++11 also provides a number of standard distributions:</p>
<ul>
<li><code><a href="http://en.wikipedia.org/wiki/Uniform_distribution_%28discrete%29" title="Uniform distribution (discrete)">uniform_int_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29" title="Uniform distribution (continuous)">uniform_real_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Bernoulli_distribution" title="Bernoulli distribution">bernoulli_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Binomial_distribution" title="Binomial distribution">binomial_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Geometric_distribution" title="Geometric distribution">geometric_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Negative_binomial_distribution" title="Negative binomial distribution">negative_binomial_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Poisson_distribution" title="Poisson distribution">poisson_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Exponential_distribution" title="Exponential distribution">exponential_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Gamma_distribution" title="Gamma distribution">gamma_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Weibull_distribution" title="Weibull distribution">weibull_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Generalized_extreme_value_distribution" title="Generalized extreme value distribution">extreme_value_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Normal_distribution" title="Normal distribution">normal_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Lognormal_distribution" title="Lognormal distribution" class="mw-redirect">lognormal_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Chi_squared_distribution" title="Chi squared distribution" class="mw-redirect">chi_squared_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Cauchy_distribution" title="Cauchy distribution">cauchy_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/F-distribution" title="F-distribution">fisher_f_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Student%27s_t-distribution" title="Student's t-distribution">student_t_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Discrete_distribution#Discrete_probability_distribution" title="Discrete distribution" class="mw-redirect">discrete_distribution</a></code>,</li>
<li><code><a href="http://en.wikipedia.org/wiki/Step_function" title="Step function">piecewise_constant_distribution</a></code> and</li>
<li><code><a href="http://en.wikipedia.org/wiki/Piecewise_linear_function" title="Piecewise linear function">piecewise_linear_distribution</a></code>.</li>
</ul>
<p>The generator and distributions are combined as in the following example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="co2">#include &lt;random&gt;</span>
<span class="co2">#include &lt;functional&gt;</span>
 
std<span class="sy4">::</span><span class="me2">uniform_int_distribution</span><span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span> distribution<span class="br0">(</span><span class="nu0">0</span>, <span class="nu0">99</span><span class="br0">)</span><span class="sy4">;</span>
std<span class="sy4">::</span><span class="me2">mt19937</span> engine<span class="sy4">;</span> <span class="co1">// Mersenne twister MT19937</span>
<span class="kw4">auto</span> generator <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">bind</span><span class="br0">(</span>distribution, engine<span class="br0">)</span><span class="sy4">;</span>
<span class="kw4">int</span> random <span class="sy1">=</span> generator<span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span> <span class="co1">// Generate a uniform integral variate between 0 and 99.</span>
<span class="kw4">int</span> random2 <span class="sy1">=</span> distribution<span class="br0">(</span>engine<span class="br0">)</span><span class="sy4">;</span> <span class="co1">// Generate another sample directly using the distribution and the engine objects.</span>
</pre></div>
</div>
<h3><span class="mw-headline" id="Wrapper_reference">Wrapper reference</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=45" title="Edit section: Wrapper reference">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>A <a href="http://en.wikipedia.org/wiki/Adapter_pattern" title="Adapter pattern">wrapper</a> reference is obtained from an instance of the template class <code>reference_wrapper</code>. Wrapper references are similar to normal references (‘<code>&amp;</code>’) of the C++ language. To obtain a wrapper reference from any object the function template <code>ref</code> is used (for a constant reference <code>cref</code> is used).</p>
<p>Wrapper references are useful above all for function templates, where references to parameters rather than copies are needed:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="co1">// This function will obtain a reference to the parameter 'r' and increment it.</span>
<span class="kw4">void</span> func <span class="br0">(</span><span class="kw4">int</span> <span class="sy3">&amp;</span>r<span class="br0">)</span>  <span class="br0">{</span> r<span class="sy2">++</span><span class="sy4">;</span> <span class="br0">}</span>
 
<span class="co1">// Template function.</span>
<span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> F, <span class="kw2">class</span> P<span class="sy1">&gt;</span> <span class="kw4">void</span> g <span class="br0">(</span>F f, P t<span class="br0">)</span>  <span class="br0">{</span> f<span class="br0">(</span>t<span class="br0">)</span><span class="sy4">;</span> <span class="br0">}</span>
 
<span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span>
<span class="br0">{</span>
    <span class="kw4">int</span> i <span class="sy1">=</span> <span class="nu0">0</span><span class="sy4">;</span>
    g <span class="br0">(</span>func, i<span class="br0">)</span><span class="sy4">;</span> <span class="co1">// 'g&lt;void (int &amp;r), int&gt;' is instantiated</span>
                 <span class="co1">// then 'i' will not be modified.</span>
    std<span class="sy4">::</span><span class="kw3">cout</span> <span class="sy1">&lt;&lt;</span> i <span class="sy1">&lt;&lt;</span> std<span class="sy4">::</span><span class="me2">endl</span><span class="sy4">;</span> <span class="co1">// Output -&gt; 0</span>
 
    g <span class="br0">(</span>func, std<span class="sy4">::</span><span class="me2">ref</span><span class="br0">(</span>i<span class="br0">)</span><span class="br0">)</span><span class="sy4">;</span> <span class="co1">// 'g&lt;void(int &amp;r),reference_wrapper&lt;int&gt;&gt;' is instantiated</span>
                           <span class="co1">// then 'i' will be modified.</span>
    std<span class="sy4">::</span><span class="kw3">cout</span> <span class="sy1">&lt;&lt;</span> i <span class="sy1">&lt;&lt;</span> std<span class="sy4">::</span><span class="me2">endl</span><span class="sy4">;</span> <span class="co1">// Output -&gt; 1</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>This new utility was added to the existing <code>&lt;utility&gt;</code> header and didn't need further extensions of the C++ language.</p>
<h3><span class="mw-headline" id="Polymorphic_wrappers_for_function_objects">Polymorphic wrappers for function objects</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=46" title="Edit section: Polymorphic wrappers for function objects">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p><a href="http://en.wikipedia.org/wiki/Type_polymorphism" title="Type polymorphism" class="mw-redirect">Polymorphic</a> <a href="http://en.wikipedia.org/wiki/Adapter_pattern" title="Adapter pattern">wrappers</a> for <a href="http://en.wikipedia.org/wiki/Function_object" title="Function object">function objects</a> are similar to <a href="http://en.wikipedia.org/wiki/Function_pointer" title="Function pointer">function pointers</a>
 in semantics and syntax, but are less tightly bound and can 
indiscriminately refer to anything which can be called (function 
pointers, member function pointers, or functors) whose arguments are 
compatible with those of the wrapper.</p>
<p>Through the example it is possible to understand its characteristics:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1">std<span class="sy4">::</span><span class="me2">function</span><span class="sy1">&lt;</span><span class="kw4">int</span> <span class="br0">(</span><span class="kw4">int</span>, <span class="kw4">int</span><span class="br0">)</span><span class="sy1">&gt;</span> func<span class="sy4">;</span> <span class="co1">// Wrapper creation using</span>
                                    <span class="co1">// template class 'function'.</span>
std<span class="sy4">::</span><span class="me2">plus</span><span class="sy1">&lt;</span><span class="kw4">int</span><span class="sy1">&gt;</span> add<span class="sy4">;</span> <span class="co1">// 'plus' is declared as 'template&lt;class T&gt; T plus( T, T ) ;'</span>
                    <span class="co1">// then 'add' is type 'int add( int x, int y )'.</span>
func <span class="sy1">=</span> add<span class="sy4">;</span>  <span class="co1">// OK - Parameters and return types are the same.</span>
 
<span class="kw4">int</span> a <span class="sy1">=</span> func <span class="br0">(</span><span class="nu0">1</span>, <span class="nu0">2</span><span class="br0">)</span><span class="sy4">;</span> <span class="co1">// NOTE: if the wrapper 'func' does not refer to any function,</span>
                     <span class="co1">// the exception 'std::bad_function_call' is thrown.</span>
 
std<span class="sy4">::</span><span class="me2">function</span><span class="sy1">&lt;</span><span class="kw4">bool</span> <span class="br0">(</span><span class="kw4">short</span>, <span class="kw4">short</span><span class="br0">)</span><span class="sy1">&gt;</span> func2 <span class="sy4">;</span>
<span class="kw1">if</span> <span class="br0">(</span><span class="sy3">!</span>func2<span class="br0">)</span> <span class="br0">{</span> <span class="co1">// True because 'func2' has not yet been assigned a function.</span>
 
    <span class="kw4">bool</span> adjacent<span class="br0">(</span><span class="kw4">long</span> x, <span class="kw4">long</span> y<span class="br0">)</span><span class="sy4">;</span>
    func2 <span class="sy1">=</span> <span class="sy3">&amp;</span>adjacent<span class="sy4">;</span> <span class="co1">// OK - Parameters and return types are convertible.</span>
 
    <span class="kw4">struct</span> Test <span class="br0">{</span>
        <span class="kw4">bool</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">short</span> x, <span class="kw4">short</span> y<span class="br0">)</span><span class="sy4">;</span>
    <span class="br0">}</span><span class="sy4">;</span>
    Test car<span class="sy4">;</span>
    func <span class="sy1">=</span> std<span class="sy4">::</span><span class="me2">ref</span><span class="br0">(</span>car<span class="br0">)</span><span class="sy4">;</span> <span class="co1">// 'std::ref' is a template function that returns the wrapper</span>
                          <span class="co1">// of member function 'operator()' of struct 'car'.</span>
<span class="br0">}</span>
func <span class="sy1">=</span> func2<span class="sy4">;</span> <span class="co1">// OK - Parameters and return types are convertible.</span>
</pre></div>
</div>
<p>The template class <code>function</code> was defined inside the header <code>&lt;functional&gt;</code>, and didn't require any changes to the C++ language.</p>
<h3><span class="mw-headline" id="Type_traits_for_metaprogramming">Type traits for metaprogramming</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=47" title="Edit section: Type traits for metaprogramming">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p><a href="http://en.wikipedia.org/wiki/Metaprogramming" title="Metaprogramming">Metaprogramming</a>
 consists of creating a program that creates or modifies another program
 (or itself). This can happen during compilation or during execution. 
The <a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B_Standards_Committee&amp;action=edit&amp;redlink=1" class="new" title="C++ Standards Committee (page does not exist)">C++ Standards Committee</a> has decided to introduce a library that allows metaprogramming during compilation through templates.</p>
<p>Here is an example of a meta-program, using the C++03 standard: a <a href="http://en.wikipedia.org/wiki/Recursion" title="Recursion">recursion</a> of template instances for calculating integer exponents:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw4">int</span> B, <span class="kw4">int</span> N<span class="sy1">&gt;</span>
<span class="kw4">struct</span> Pow <span class="br0">{</span>
    <span class="co1">// recursive call and recombination.</span>
    <span class="kw2">enum</span><span class="br0">{</span> value <span class="sy1">=</span> B<span class="sy2">*</span>Pow<span class="sy1">&lt;</span>B, N<span class="sy2">-</span><span class="nu0">1</span><span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">value</span> <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw2">template</span><span class="sy1">&lt;</span> <span class="kw4">int</span> B <span class="sy1">&gt;</span>
<span class="kw4">struct</span> Pow<span class="sy1">&lt;</span>B, <span class="nu0">0</span><span class="sy1">&gt;</span> <span class="br0">{</span>
    <span class="co1">// ''N == 0'' condition of termination.</span>
    <span class="kw2">enum</span><span class="br0">{</span> value <span class="sy1">=</span> <span class="nu0">1</span> <span class="br0">}</span><span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
<span class="kw4">int</span> quartic_of_three <span class="sy1">=</span> Pow<span class="sy1">&lt;</span><span class="nu0">3</span>, <span class="nu0">4</span><span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">value</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Many algorithms can operate on different types of data; C++'s <a href="http://en.wikipedia.org/wiki/Template_%28programming%29" title="Template (programming)" class="mw-redirect">templates</a> support <a href="http://en.wikipedia.org/wiki/Generic_programming" title="Generic programming">generic programming</a>
 and make code more compact and useful. Nevertheless it is common for 
algorithms to need information on the data types being used. This 
information can be extracted during instantiation of a template class 
using <b>type traits</b>.</p>
<p><b>Type traits</b> can identify the category of an object and all the
 characteristics of a class (or of a struct). They are defined in the 
new header <code>&lt;type_traits&gt;</code>.</p>
<p>In the next example there is the template function ‘elaborate’ that, 
depending on the given data types, will instantiate one of the two 
proposed algorithms (<code>algorithm.do_it</code>).</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="co1">// First way of operating.</span>
<span class="kw2">template</span><span class="sy1">&lt;</span> <span class="kw4">bool</span> B <span class="sy1">&gt;</span> <span class="kw4">struct</span> Algorithm <span class="br0">{</span>
    <span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> T1, <span class="kw2">class</span> T2<span class="sy1">&gt;</span> <span class="kw4">static</span> <span class="kw4">int</span> do_it <span class="br0">(</span>T1 <span class="sy3">&amp;</span>, T2 <span class="sy3">&amp;</span><span class="br0">)</span>  <span class="br0">{</span> <span class="coMULTI">/*...*/</span> <span class="br0">}</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="co1">// Second way of operating.</span>
<span class="kw2">template</span><span class="sy1">&lt;&gt;</span> <span class="kw4">struct</span> Algorithm<span class="sy1">&lt;</span><span class="kw2">true</span><span class="sy1">&gt;</span> <span class="br0">{</span>
    <span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> T1, <span class="kw2">class</span> T2<span class="sy1">&gt;</span> <span class="kw4">static</span> <span class="kw4">int</span> do_it <span class="br0">(</span>T1, T2<span class="br0">)</span>  <span class="br0">{</span> <span class="coMULTI">/*...*/</span> <span class="br0">}</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="co1">// Instantiating 'elaborate' will automatically instantiate the correct way to operate.</span>
<span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> T1, <span class="kw2">class</span> T2<span class="sy1">&gt;</span>
<span class="kw4">int</span> elaborate <span class="br0">(</span>T1 A, T2 B<span class="br0">)</span>
<span class="br0">{</span>
    <span class="co1">// Use the second way only if 'T1' is an integer and if 'T2' is</span>
    <span class="co1">// in floating point, otherwise use the first way.</span>
    <span class="kw1">return</span> Algorithm<span class="sy1">&lt;</span>std<span class="sy4">::</span><span class="me2">is_integral</span><span class="sy1">&lt;</span>T1<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">value</span> <span class="sy3">&amp;&amp;</span> std<span class="sy4">::</span><span class="me2">is_floating_point</span><span class="sy1">&lt;</span>T2<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">value</span><span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">do_it</span><span class="br0">(</span> A, B <span class="br0">)</span> <span class="sy4">;</span>
<span class="br0">}</span>
</pre></div>
</div>
<p>Through <b>type traits</b>, defined in header <code>&lt;type_traits&gt;</code>, it’s also possible to create type transformation operations (<code>static_cast</code> and <code>const_cast</code> are insufficient inside a template).</p>
<p>This type of programming produces elegant and concise code; however 
the weak point of these techniques is the debugging: uncomfortable 
during compilation and very difficult during program execution.</p>
<h3><span class="mw-headline" id="Uniform_method_for_computing_the_return_type_of_function_objects">Uniform method for computing the return type of function objects</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=48" title="Edit section: Uniform method for computing the return type of function objects">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>Determining the return type of a template function object at 
compile-time is not intuitive, particularly if the return value depends 
on the parameters of the function. As an example:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> Clear <span class="br0">{</span>
    <span class="kw4">int</span>    operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>    <span class="co1">// The parameter type is</span>
    <span class="kw4">double</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">double</span><span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span> <span class="co1">// equal to the return type.</span>
<span class="br0">}</span><span class="sy4">;</span>
 
<span class="kw2">template</span> <span class="sy1">&lt;</span><span class="kw2">class</span> Obj<span class="sy1">&gt;</span>
<span class="kw2">class</span> Calculus <span class="br0">{</span>
<span class="kw2">public</span><span class="sy4">:</span>
    <span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> Arg<span class="sy1">&gt;</span> Arg operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span>Arg<span class="sy3">&amp;</span> a<span class="br0">)</span> <span class="kw4">const</span> <span class="br0">{</span>
        <span class="kw1">return</span> member<span class="br0">(</span>a<span class="br0">)</span><span class="sy4">;</span>
    <span class="br0">}</span>
<span class="kw2">private</span><span class="sy4">:</span>
    Obj member<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Instantiating the class template <code>Calculus&lt;Clear&gt;</code>, the function object of <code>calculus</code> will have always the same return type as the function object of <code>Clear</code>. However, given class <code>Confused</code> below:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw4">struct</span> Confused <span class="br0">{</span>
    <span class="kw4">double</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>     <span class="co1">// The parameter type is not</span>
    <span class="kw4">int</span>    operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span><span class="kw4">double</span><span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span>  <span class="co1">// equal to the return type.</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>Attempting to instantiate <code>Calculus&lt;Confused&gt;</code> will cause the return type of <code>Calculus</code> to not be the same as that of class <code>Confused</code>. The compiler may generate warnings about the conversion from <code>int</code> to <code>double</code> and vice-versa.</p>
<p>TR1 introduces, and C++11 adopts, the template class <code>std::result_of</code> that allows one to determine and use the return type of a function object for every declaration. The object <code>CalculusVer2</code> uses the <code>std::result_of</code> object to derive the return type of the function object:</p>
<div dir="ltr" class="mw-geshi mw-code mw-content-ltr">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw2">template</span><span class="sy1">&lt;</span> <span class="kw2">class</span> Obj <span class="sy1">&gt;</span>
<span class="kw2">class</span> CalculusVer2 <span class="br0">{</span>
<span class="kw2">public</span><span class="sy4">:</span>
    <span class="kw2">template</span><span class="sy1">&lt;</span><span class="kw2">class</span> Arg<span class="sy1">&gt;</span>
    <span class="kw2">typename</span> std<span class="sy4">::</span><span class="me2">result_of</span><span class="sy1">&lt;</span>Obj<span class="br0">(</span>Arg<span class="br0">)</span><span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">type</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span>Arg<span class="sy3">&amp;</span> a<span class="br0">)</span> <span class="kw4">const</span> <span class="br0">{</span>
        <span class="kw1">return</span> member<span class="br0">(</span>a<span class="br0">)</span><span class="sy4">;</span>
    <span class="br0">}</span>
<span class="kw2">private</span><span class="sy4">:</span>
    Obj member<span class="sy4">;</span>
<span class="br0">}</span><span class="sy4">;</span>
</pre></div>
</div>
<p>In this way in instances of function object of <code>CalculusVer2&lt;Confused&gt;</code> there are no conversions, warnings, or errors.</p>
<p>The only change from the TR1 version of <code>std::result_of</code> 
is that the TR1 version allowed an implementation to fail to be able to 
determine the result type of a function call. Due to changes to C++ for 
supporting <code><a href="#Type_inference">decltype</a></code>, the C++11 version of <code>std::result_of</code> no longer needs these special cases; implementations are required to compute a type in all cases.</p>
<h2><span class="mw-headline" id="Improved_C_compatibility">Improved C compatibility</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=49" title="Edit section: Improved C compatibility">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>The following were added for compatibility with <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C</a>, from C99:<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span>[</span>16<span>]</span></a></sup></p>
<ul>
<li>Preprocessor <sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span>[</span>17<span>]</span></a></sup>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Variadic_macro" title="Variadic macro">variadic macros</a></li>
<li>concatenation of adjacent narrow/wide string literals</li>
<li><code>_Pragma()</code> - Equivalent of <code>#pragma</code></li>
</ul>
</li>
<li><code>long long</code> Integer type that is at least 64-bits long.</li>
<li><code>__func__</code> - Macro evaluating to the name of the function it is in.</li>
<li>Headers:
<ul>
<li><code>cstdbool</code> (<code>stdbool.h</code>)</li>
<li><code>cstdint</code> (<code>stdint.h</code>)</li>
<li><code>cinttypes</code> (<code>inttypes.h</code>).</li>
</ul>
</li>
</ul>
<h2><span class="mw-headline" id="Features_originally_planned_but_removed_or_not_included">Features originally planned but removed or not included</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=50" title="Edit section: Features originally planned but removed or not included">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>Heading for a separate TR:</p>
<ul>
<li><a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3347.pdf">Modules</a></li>
<li>Decimal Types</li>
<li>Math Special Functions</li>
</ul>
<p>Postponed:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Concepts_%28C%2B%2B%29" title="Concepts (C++)">Concepts</a></li>
<li>More complete or required garbage collection support</li>
<li>Reflection</li>
<li>Macro Scopes</li>
</ul>
<h2><span class="mw-headline" id="Features_removed_or_deprecated">Features removed or deprecated</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=51" title="Edit section: Features removed or deprecated">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>The term <a href="http://en.wikipedia.org/wiki/Sequence_point" title="Sequence point">sequence point</a>
 was removed, being replaced by specifying that either one operation is 
sequenced before another, or that two operations are unsequenced.<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span>[</span>18<span>]</span></a></sup></p>
<p>The former use of the keyword <code><a href="http://en.wikipedia.org/wiki/Export_%28C%2B%2B%29" title="Export (C++)" class="mw-redirect">export</a></code> was removed.<sup id="cite_ref-sutter0310_19-0" class="reference"><a href="#cite_note-sutter0310-19"><span>[</span>19<span>]</span></a></sup> The keyword itself remains, being reserved for potential future use.</p>
<p>Dynamic <a href="http://en.wikipedia.org/wiki/Exception_specification" title="Exception specification" class="mw-redirect">exception specifications</a> are deprecated.<sup id="cite_ref-sutter0310_19-1" class="reference"><a href="#cite_note-sutter0310-19"><span>[</span>19<span>]</span></a></sup> Compile time specification of non-exception throwing functions is available with the <code>noexcept</code> keyword, which is useful for optimization.</p>
<p><code><a href="http://en.wikipedia.org/wiki/Auto_ptr" title="Auto ptr">std::auto_ptr</a></code> is deprecated, having been superseded by <code>std::unique_ptr</code>.</p>
<p>Function object base classes (<code>std::unary_function</code>, <code>std::binary_function</code>), adapters to pointers to functions and adapters to pointers to members, and binder classes are all deprecated.</p>
<h2><span class="mw-headline" id="See_also">See also</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=52" title="Edit section: See also">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<ul>
<li><a href="http://en.wikipedia.org/wiki/C%2B%2B_Technical_Report_1" title="C++ Technical Report 1">C++ Technical Report 1 (2007)</a></li>
<li><a href="http://en.wikipedia.org/wiki/C99" title="C99">C99</a></li>
<li><a href="http://en.wikipedia.org/wiki/C11_%28C_standard_revision%29" title="C11 (C standard revision)">C11</a></li>
<li><a href="http://en.wikipedia.org/wiki/C%2B%2B14" title="C++14">C++14</a></li>
</ul>
<h2><span class="mw-headline" id="References">References</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=53" title="Edit section: References">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<div class="reflist" style="list-style-type: decimal;">
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://herbsutter.com/2011/08/12/we-have-an-international-standard-c0x-is-unanimously-approved/">"We have an international standard: C++0x is unanimously approved"</a><span class="reference-accessdate">. Retrieved 12 August 2011</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=We+have+an+international+standard%3A+C%2B%2B0x+is+unanimously+approved&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fherbsutter.com%2F2011%2F08%2F12%2Fwe-have-an-international-standard-c0x-is-unanimously-approved%2F&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://www.research.ibm.com/arl/seminar/media/stroustrup.pdf">"Bjarne Stroustrup: A C++0x overview"</a><span class="reference-accessdate">. Retrieved 30 June 2011</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=Bjarne+Stroustrup%3A+A+C%2B%2B0x+overview&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fwww.research.ibm.com%2Farl%2Fseminar%2Fmedia%2Fstroustrup.pdf&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372">"ISO/IEC 14882:2011"</a>. ISO. 2 September 2011<span class="reference-accessdate">. Retrieved 3 September 2011</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=ISO%2FIEC+14882%3A2011&amp;rft.date=2+September+2011&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fwww.iso.org%2Fiso%2Fiso_catalogue%2Fcatalogue_tc%2Fcatalogue_detail.htm%3Fcsnumber%3D50372&amp;rft.pub=ISO&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf">"Working Draft, Standard for Programming Language C++"</a>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=Working+Draft%2C+Standard+for+Programming+Language+C%2B%2B&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2012%2Fn3337.pdf&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://isocpp.org/std/the-standard">"The Standard"</a><span class="reference-accessdate">. Retrieved 2012-11-02</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=The+Standard&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fisocpp.org%2Fstd%2Fthe-standard&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://www.h-online.com/open/news/item/Next-C-standard-to-arrive-in-2017-1743138.html">"Next C++ standard to arrive in 2017"</a>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=Next+C%2B%2B+standard+to+arrive+in+2017&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fwww.h-online.com%2Fopen%2Fnews%2Fitem%2FNext-C-standard-to-arrive-in-2017-1743138.html&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-Sutter_Alexandrescu-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-Sutter_Alexandrescu_7-0"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text">Sutter, Alexandrescu "C++ coding standards" #15</span></li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web">Gabriel Dos Reis and Bjarne Stroustrup (22 March 2010). <a rel="nofollow" class="external text" href="http://www.stroustrup.com/sac10-constexpr.pdf">"General Constant Expressions for System Programming Languages, Proceedings SAC ’10"</a>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.au=Gabriel+Dos+Reis+and+Bjarne+Stroustrup&amp;rft.aulast=Gabriel+Dos+Reis+and+Bjarne+Stroustrup&amp;rft.btitle=General+Constant+Expressions+for+System+Programming+Languages%2C+Proceedings+SAC+%E2%80%9910&amp;rft.date=22+March+2010&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fwww.stroustrup.com%2Fsac10-constexpr.pdf&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1968.pdf">"Document no: N1968=06-0038- Lambda expressions and closures for C++"</a>. Open Standards.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=Document+no%3A+N1968%3D06-0038-+Lambda+expressions+and+closures+for+C%2B%2B&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2006%2Fn1968.pdf&amp;rft.pub=Open+Standards&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-C.2B.2B03_3.2.2F3-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-C.2B.2B03_3.2.2F3_10-0"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><a href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization" title="International Organization for Standardization">ISO</a>/<a href="http://en.wikipedia.org/wiki/International_Electrotechnical_Commission" title="International Electrotechnical Commission">IEC</a> (2003). <i><a href="http://en.wikipedia.org/wiki/ISO/IEC_14882" title="ISO/IEC 14882" class="mw-redirect">ISO/IEC 14882:2003(E): Programming Languages – C++</a> §3.2 One definition rule [basic.def.odr]</i> para. 3</span></li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2210.html#%22default%22">"Defaulted and Deleted Functions – ISO/IEC JTC1 SC22 WG21 N2210 = 07-0070 – 2007-03-11"</a>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=Defaulted+and+Deleted+Functions+%E2%80%93+ISO%2FIEC+JTC1+SC22+WG21+N2210+%3D+07-0070+%E2%80%93+2007-03-11&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2007%2Fn2210.html%23%2522default%2522&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://gcc.gnu.org/onlinedocs/gcc/Long-Long.html">Long Long – Using the GNU Compiler Collection (GCC)</a></span></li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/s3f49ktz%28VS.80%29.aspx">Data Type Ranges (C++)</a></span></li>
<li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text">Samuel P. Harbison III, Guy L. Steele Jr.: "C – A Reference Manual", 5th edition, p.251</span></li>
<li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web">Milewski, Bartosz (3 March 2009). <a rel="nofollow" class="external text" href="http://bartoszmilewski.wordpress.com/2009/03/03/broken-promises-c0x-futures/">"Broken promises–C++0x futures"</a><span class="reference-accessdate">. Retrieved 24 January 2010</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.aufirst=Bartosz&amp;rft.aulast=Milewski&amp;rft.au=Milewski%2C+Bartosz&amp;rft.btitle=Broken+promises%E2%80%93C%2B%2B0x+futures&amp;rft.date=3+March+2009&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fbartoszmilewski.wordpress.com%2F2009%2F03%2F03%2Fbroken-promises-c0x-futures%2F&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web"><a rel="nofollow" class="external text" href="http://clang.llvm.org/cxx_status.html">"Clang - C++98, C++11, and C++14 Status"</a>. Clang.llvm.org. 2013-05-12<span class="reference-accessdate">. Retrieved 2013-06-10</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.btitle=Clang+-+C%2B%2B98%2C+C%2B%2B11%2C+and+C%2B%2B14+Status&amp;rft.date=2013-05-12&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fclang.llvm.org%2Fcxx_status.html&amp;rft.pub=Clang.llvm.org&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm">Working draft changes for C99 preprocessor synchronization</a></span></li>
<li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18"><span class="cite-accessibility-label">Jump up </span>^</a></b></span> <span class="reference-text"><span class="citation web">Caves, Jonathan (4 June 2007). <a rel="nofollow" class="external text" href="http://blogs.msdn.com/b/vcblog/archive/2007/06/04/update-on-the-c-0x-language-standard.aspx">"Update on the C++-0x Language Standard"</a><span class="reference-accessdate">. Retrieved 25 May 2010</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.au=Caves%2C+Jonathan&amp;rft.aufirst=Jonathan&amp;rft.aulast=Caves&amp;rft.btitle=Update+on+the+C%2B%2B-0x+Language+Standard&amp;rft.date=4+June+2007&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fblogs.msdn.com%2Fb%2Fvcblog%2Farchive%2F2007%2F06%2F04%2Fupdate-on-the-c-0x-language-standard.aspx&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
<li id="cite_note-sutter0310-19"><span class="mw-cite-backlink">^ <a href="#cite_ref-sutter0310_19-0"><span class="cite-accessibility-label">Jump up to: </span><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-sutter0310_19-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><span class="citation web"><a href="http://en.wikipedia.org/wiki/Herb_Sutter" title="Herb Sutter">Sutter, Herb</a> (3 March 2010). <a rel="nofollow" class="external text" href="http://herbsutter.com/2010/03/13/trip-report-march-2010-iso-c-standards-meeting/">"Trip Report: March 2010 ISO C++ Standards Meeting"</a><span class="reference-accessdate">. Retrieved 24 March 2010</span>.</span><span title="ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AC%2B%2B11&amp;rft.aufirst=Herb&amp;rft.aulast=Sutter&amp;rft.au=Sutter%2C+Herb&amp;rft.btitle=Trip+Report%3A+March+2010+ISO+C%2B%2B+Standards+Meeting&amp;rft.date=3+March+2010&amp;rft.genre=book&amp;rft_id=http%3A%2F%2Fherbsutter.com%2F2010%2F03%2F13%2Ftrip-report-march-2010-iso-c-standards-meeting%2F&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook" class="Z3988"><span style="display:none;">&nbsp;</span></span></span></li>
</ol>
</div>
<h2><span class="mw-headline" id="External_links">External links</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit&amp;section=54" title="Edit section: External links">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<ul>
<li><a rel="nofollow" class="external text" href="http://www.open-std.org/jtc1/sc22/wg21/">The C++ Standards Committee</a></li>
<li><a rel="nofollow" class="external text" href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=216">C++0X: The New Face of Standard C++</a></li>
<li><a rel="nofollow" class="external text" href="http://herbsutter.wordpress.com/">Herb Sutter's blog coverage of C++11</a></li>
<li><a rel="nofollow" class="external text" href="http://www.justsoftwaresolutions.co.uk/cplusplus/">Anthony Williams' blog coverage of C++11</a></li>
<li><a rel="nofollow" class="external text" href="http://www.csclub.uwaterloo.ca/media/C++0x%20-%20An%20Overview.html">A talk on C++0x given by Bjarne Stroustrup at the University of Waterloo</a></li>
<li><a rel="nofollow" class="external text" href="http://www.devx.com/SpecialReports/Article/38813/0/page/1">The State of the Language: An Interview with Bjarne Stroustrup (15 August 2008)</a></li>
<li><a rel="nofollow" class="external text" href="http://wiki.apache.org/stdcxx/C++0xCompilerSupport">Wiki page to help keep track of C++ 0x core language features and their availability in compilers</a></li>
<li><a rel="nofollow" class="external text" href="http://en.cppreference.com/">Online C++11 standard library reference</a></li>
<li><a rel="nofollow" class="external text" href="http://stacked-crooked.com/">Online C++11 compiler</a></li>
</ul>
<table class="navbox" style="border-spacing:0;" cellspacing="0">
<tbody><tr>
<td style="padding:2px;">
<table id="collapsibleTable1" class="nowraplinks hlist collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit;" cellspacing="0">
<tbody><tr>
<th scope="col" class="navbox-title" colspan="2"><span class="collapseButton">[<a href="#" id="collapseButton1">show</a>]</span>
<div class="plainlinks hlist navbar mini">
<ul>
<li class="nv-view"><a href="http://en.wikipedia.org/wiki/Template:C_programming_language" title="Template:C programming language"><span title="View this template" style=";;background:none transparent;border:none;;">v</span></a></li>
<li class="nv-talk"><a href="http://en.wikipedia.org/wiki/Template_talk:C_programming_language" title="Template talk:C programming language"><span title="Discuss this template" style=";;background:none transparent;border:none;;">t</span></a></li>
<li class="nv-edit"><a class="external text" href="http://en.wikipedia.org/w/index.php?title=Template:C_programming_language&amp;action=edit"><span title="Edit this template" style=";;background:none transparent;border:none;;">e</span></a></li>
</ul>
</div>
<div style="font-size:110%;"><a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" title="C (programming language)">C programming language</a></div>
</th>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<td class="navbox-abovebelow" colspan="2">
<div>
<ul>
<li><a href="http://en.wikipedia.org/wiki/ANSI_C" title="ANSI C">ANSI C</a>
<ul>
<li><a href="http://en.wikipedia.org/wiki/ANSI_C#C89_and_C90" title="ANSI C">C89 and C90</a></li>
</ul>
</li>
<li><a href="http://en.wikipedia.org/wiki/C99" title="C99">C99</a></li>
<li><a href="http://en.wikipedia.org/wiki/C11_%28C_standard_revision%29" title="C11 (C standard revision)">C11</a></li>
<li><a href="http://en.wikipedia.org/wiki/Embedded_C" title="Embedded C">Embedded C</a></li>
<li><a href="http://en.wikipedia.org/wiki/MISRA_C" title="MISRA C">MISRA C</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<th scope="row" class="navbox-group">C features</th>
<td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;">
<div style="padding:0em 0.25em;">
<ul>
<li><a href="http://en.wikipedia.org/wiki/Subroutine" title="Subroutine">Functions</a></li>
<li><a href="http://en.wikipedia.org/wiki/Include_directive#C" title="Include directive">Header files</a></li>
<li><a href="http://en.wikipedia.org/wiki/Category:C_libraries" title="Category:C libraries">Libraries</a></li>
<li><a href="http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B" title="Operators in C and C++">Operators</a></li>
<li><a href="http://en.wikipedia.org/wiki/Null-terminated_string" title="Null-terminated string">String</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_syntax" title="C syntax">Syntax</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_preprocessor" title="C preprocessor">Preprocessor</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_data_types" title="C data types">Data types</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<th scope="row" class="navbox-group"><a href="http://en.wikipedia.org/wiki/C_standard_library" title="C standard library">C standard library functions</a></th>
<td class="navbox-list navbox-even" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;">
<div style="padding:0em 0.25em;">
<ul>
<li><a href="http://en.wikipedia.org/wiki/C_character_classification" title="C character classification">Char (ctype.h)</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_file_input/output" title="C file input/output">File I/O (stdio.h)</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_mathematical_functions" title="C mathematical functions">Math (math.h)</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_dynamic_memory_allocation" title="C dynamic memory allocation">Dynamic memory (stdlib.h)</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_string_handling" title="C string handling">String (string.h)</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_date_and_time_functions" title="C date and time functions">Time (time.h)</a></li>
<li><a href="http://en.wikipedia.org/wiki/Stdarg.h" title="Stdarg.h">Variadic (stdarg.h)</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_POSIX_library" title="C POSIX library">POSIX</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<th scope="row" class="navbox-group"><a href="http://en.wikipedia.org/wiki/Category:C_standard_library" title="Category:C standard library">C standard libraries</a></th>
<td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;">
<div style="padding:0em 0.25em;">
<ul>
<li><a href="http://en.wikipedia.org/wiki/Bionic_%28software%29" title="Bionic (software)">Bionic</a>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Hybris_%28software%29" title="Hybris (software)">libhybris</a></li>
</ul>
</li>
<li><a href="http://en.wikipedia.org/wiki/Dietlibc" title="Dietlibc">dietlibc</a></li>
<li><a href="http://en.wikipedia.org/wiki/Embedded_GLIBC" title="Embedded GLIBC">EGLIBC</a></li>
<li><a href="http://en.wikipedia.org/wiki/GNU_C_Library" title="GNU C Library">glibc</a></li>
<li><a href="http://en.wikipedia.org/wiki/Klibc" title="Klibc">klibc</a></li>
<li><a href="http://en.wikipedia.org/wiki/Microsoft_Windows_library_files#MSVCRT.DLL_and_MSVCPP.DLL" title="Microsoft Windows library files">Microsoft Run-time Library</a></li>
<li><a href="http://en.wikipedia.org/wiki/Musl" title="Musl">musl</a></li>
<li><a href="http://en.wikipedia.org/wiki/Newlib" title="Newlib">Newlib</a></li>
<li><a href="http://en.wikipedia.org/wiki/UClibc" title="UClibc">uClibc</a></li>
<li><a href="http://en.wikipedia.org/wiki/BSD_libc" title="BSD libc" class="mw-redirect">BSD libc</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<th scope="row" class="navbox-group"><a href="http://en.wikipedia.org/wiki/Category:C_compilers" title="Category:C compilers">Compilers</a></th>
<td class="navbox-list navbox-even" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;">
<div style="padding:0em 0.25em;">
<ul>
<li><a href="http://en.wikipedia.org/wiki/List_of_compilers#C_compilers" title="List of compilers">Comparison of C compilers</a></li>
<li><a href="http://en.wikipedia.org/wiki/Amsterdam_Compiler_Kit" title="Amsterdam Compiler Kit">ACK</a></li>
<li><a href="http://en.wikipedia.org/wiki/Borland_Turbo_C" title="Borland Turbo C">Borland Turbo C</a></li>
<li><a href="http://en.wikipedia.org/wiki/Clang" title="Clang">Clang</a></li>
<li><a href="http://en.wikipedia.org/wiki/GNU_Compiler_Collection" title="GNU Compiler Collection">GCC</a></li>
<li><a href="http://en.wikipedia.org/wiki/LCC_%28compiler%29" title="LCC (compiler)">LCC</a></li>
<li><a href="http://en.wikipedia.org/wiki/Pelles_C" title="Pelles C">Pelles C</a></li>
<li><a href="http://en.wikipedia.org/wiki/Portable_C_Compiler" title="Portable C Compiler">PCC</a></li>
<li><a href="http://en.wikipedia.org/wiki/Tiny_C_Compiler" title="Tiny C Compiler">TCC</a></li>
<li><a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio" title="Microsoft Visual Studio">Microsoft Visual Studio</a> <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio_Express" title="Microsoft Visual Studio Express">Express</a> <a href="http://en.wikipedia.org/wiki/Visual_C%2B%2B" title="Visual C++">C++</a></li>
<li><a href="http://en.wikipedia.org/wiki/Watcom_C/C%2B%2B_compiler" title="Watcom C/C++ compiler">Watcom C/C++</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<th scope="row" class="navbox-group"><a href="http://en.wikipedia.org/wiki/Category:Integrated_development_environments" title="Category:Integrated development environments">IDEs</a></th>
<td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;">
<div style="padding:0em 0.25em;">
<ul>
<li><a href="http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments#C.2FC.2B.2B" title="Comparison of integrated development environments">Comparison of C IDEs</a></li>
<li><a href="http://en.wikipedia.org/wiki/Anjuta" title="Anjuta">Anjuta</a></li>
<li><a href="http://en.wikipedia.org/wiki/Code::Blocks" title="Code::Blocks">Code::Blocks</a></li>
<li><a href="http://en.wikipedia.org/wiki/CodeLite" title="CodeLite">CodeLite</a></li>
<li><a href="http://en.wikipedia.org/wiki/Eclipse_%28software%29" title="Eclipse (software)">Eclipse</a></li>
<li><a href="http://en.wikipedia.org/wiki/Geany" title="Geany">Geany</a></li>
<li><a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio" title="Microsoft Visual Studio">Microsoft Visual Studio</a></li>
<li><a href="http://en.wikipedia.org/wiki/NetBeans" title="NetBeans">NetBeans</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<th scope="row" class="navbox-group">C and other languages</th>
<td class="navbox-list navbox-even" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;">
<div style="padding:0em 0.25em;">
<ul>
<li><a href="http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B" title="Compatibility of C and C++">Compatibility of C and C++</a></li>
<li><a href="http://en.wikipedia.org/wiki/Embedded_C#Difference_between_C_and_Embedded_C" title="Embedded C">Comparison of C and Embedded C</a></li>
<li><a href="http://en.wikipedia.org/wiki/Comparison_of_Pascal_and_C" title="Comparison of Pascal and C">Comparison of C and Pascal</a></li>
<li><a href="http://en.wikipedia.org/wiki/Comparison_of_programming_languages" title="Comparison of programming languages">Comparison of programming languages</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<th scope="row" class="navbox-group">Descendant languages</th>
<td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px;">
<div style="padding:0em 0.25em;">
<ul>
<li><a href="http://en.wikipedia.org/wiki/C%2B%2B" title="C++">C++</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29" title="C Sharp (programming language)">C#</a></li>
<li><a href="http://en.wikipedia.org/wiki/D_%28programming_language%29" title="D (programming language)">D</a></li>
<li><a href="http://en.wikipedia.org/wiki/Objective-C" title="Objective-C">Objective-C</a></li>
<li><a href="http://en.wikipedia.org/wiki/Alef_%28programming_language%29" title="Alef (programming language)">Alef</a></li>
<li><a href="http://en.wikipedia.org/wiki/Limbo_%28programming_language%29" title="Limbo (programming language)">Limbo</a></li>
<li><a href="http://en.wikipedia.org/wiki/Go_%28programming_language%29" title="Go (programming language)">Go</a></li>
<li><a href="http://en.wikipedia.org/wiki/Vala_%28programming_language%29" title="Vala (programming language)">Vala</a></li>
</ul>
</div>
</td>
</tr>
<tr style="height: 2px; display: none;">
<td colspan="2"></td>
</tr>
<tr style="display: none;">
<td class="navbox-abovebelow" colspan="2">
<div>
<ul>
<li><img alt="Category" src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/16px-Folder_Hexagonal_Icon.png" srcset="//upload.wikimedia.org/wikipedia/en/thumb/4/48/Folder_Hexagonal_Icon.svg/24px-Folder_Hexagonal_Icon.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/4/48/Folder_Hexagonal_Icon.svg/32px-Folder_Hexagonal_Icon.svg.png 2x" data-file-width="36" data-file-height="31" height="14" width="16"> <b><a href="http://en.wikipedia.org/wiki/Category:C_programming_language" title="Category:C programming language">Category</a></b></li>
</ul>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>


<!-- 
NewPP limit report
Parsed by mw1016
CPU time usage: 2.392 seconds
Real time usage: 2.493 seconds
Preprocessor visited node count: 3268/1000000
Preprocessor generated node count: 13032/1500000
Post‐expand include size: 64542/2048000 bytes
Template argument size: 1966/2048000 bytes
Highest expansion depth: 18/40
Expensive parser function count: 11/500
Lua time usage: 0.147/10.000 seconds
Lua memory usage: 3.14 MB/50 MB
-->

<!-- Saved in parser cache with key enwiki:pcache:idhash:5481447-0!*!0!!en!4!* and timestamp 20140728180932 and revision id 614206455
 -->
<noscript><img src="//en.wikipedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" title="" width="1" height="1" style="border: none; position: absolute;" /></noscript></div>									<div class="printfooter">
						Retrieved from "<a dir="ltr" href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;oldid=614206455">http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;oldid=614206455</a>"					</div>
													<div id="catlinks" class="catlinks"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="http://en.wikipedia.org/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="http://en.wikipedia.org/wiki/Category:C%2B%2B" title="Category:C++">C++</a></li><li><a href="http://en.wikipedia.org/wiki/Category:Programming_language_standards" title="Category:Programming language standards">Programming language standards</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="http://en.wikipedia.org/wiki/Category:Wikipedia_articles_needing_style_editing_from_July_2012" title="Category:Wikipedia articles needing style editing from July 2012">Wikipedia articles needing style editing from July 2012</a></li><li><a href="http://en.wikipedia.org/wiki/Category:All_articles_needing_style_editing" title="Category:All articles needing style editing">All articles needing style editing</a></li><li><a href="http://en.wikipedia.org/wiki/Category:Articles_needing_additional_references_from_July_2012" title="Category:Articles needing additional references from July 2012">Articles needing additional references from July 2012</a></li><li><a href="http://en.wikipedia.org/wiki/Category:All_articles_needing_additional_references" title="Category:All articles needing additional references">All articles needing additional references</a></li><li><a href="http://en.wikipedia.org/wiki/Category:Wikipedia_introduction_cleanup_from_July_2012" title="Category:Wikipedia introduction cleanup from July 2012">Wikipedia introduction cleanup from July 2012</a></li><li><a href="http://en.wikipedia.org/wiki/Category:All_pages_needing_cleanup" title="Category:All pages needing cleanup">All pages needing cleanup</a></li><li><a href="http://en.wikipedia.org/wiki/Category:Articles_covered_by_WikiProject_Wikify_from_July_2012" title="Category:Articles covered by WikiProject Wikify from July 2012">Articles covered by WikiProject Wikify from July 2012</a></li><li><a href="http://en.wikipedia.org/wiki/Category:All_articles_covered_by_WikiProject_Wikify" title="Category:All articles covered by WikiProject Wikify">All articles covered by WikiProject Wikify</a></li><li><a href="http://en.wikipedia.org/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="http://en.wikipedia.org/wiki/Category:Articles_with_unsourced_statements_from_August_2013" title="Category:Articles with unsourced statements from August 2013">Articles with unsourced statements from August 2013</a></li><li><a href="http://en.wikipedia.org/wiki/Category:Articles_with_example_C%2B%2B_code" title="Category:Articles with example C++ code">Articles with example C++ code</a></li></ul></div></div>												<div class="visualClear"></div>
							</div>
		</div>
		<div id="mw-navigation">
			<h2>Navigation menu</h2>

			<div id="mw-head">
									<div id="p-personal" role="navigation" class="" aria-labelledby="p-personal-label">
						<h3 id="p-personal-label">Personal tools</h3>
						<ul>
							<li id="pt-createaccount"><a href="http://en.wikipedia.org/w/index.php?title=Special:UserLogin&amp;returnto=C%2B%2B11&amp;type=signup">Create account</a></li><li id="pt-login"><a href="http://en.wikipedia.org/w/index.php?title=Special:UserLogin&amp;returnto=C%2B%2B11" title="You're encouraged to log in; however, it's not mandatory. [Alt+Shift+o]" accesskey="o">Log in</a></li>						</ul>
					</div>
									<div id="left-navigation">
										<div id="p-namespaces" role="navigation" class="vectorTabs" aria-labelledby="p-namespaces-label">
						<h3 id="p-namespaces-label">Namespaces</h3>
						<ul>
															<li id="ca-nstab-main" class="selected"><span><a href="http://en.wikipedia.org/wiki/C%2B%2B11" title="View the content page [Alt+Shift+c]" accesskey="c">Article</a></span></li>
															<li id="ca-talk"><span><a href="http://en.wikipedia.org/wiki/Talk:C%2B%2B11" title="Discussion about the content page [Alt+Shift+t]" accesskey="t">Talk</a></span></li>
													</ul>
					</div>
										<div id="p-variants" role="navigation" class="vectorMenu emptyPortlet" aria-labelledby="p-variants-label">
						<h3 id="mw-vector-current-variant">
													</h3>

						<h3 tabindex="0" id="p-variants-label"><span>Variants</span><a tabindex="-1" href="#"></a></h3>

						<div class="menu">
							<ul>
															</ul>
						</div>
					</div>
									</div>
				<div id="right-navigation">
										<div id="p-views" role="navigation" class="vectorTabs" aria-labelledby="p-views-label">
						<h3 id="p-views-label">Views</h3>
						<ul>
															<li id="ca-view" class="selected"><span><a href="http://en.wikipedia.org/wiki/C%2B%2B11">Read</a></span></li>
															<li id="ca-edit"><span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=edit" title="You can edit this page. Please use the preview button before saving [Alt+Shift+e]" accesskey="e">Edit</a></span></li>
															<li id="ca-history" class="collapsible"><span><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=history" title="Past versions of this page [Alt+Shift+h]" accesskey="h">View history</a></span></li>
													</ul>
					</div>
										<div style="" id="p-cactions" role="navigation" class="vectorMenu emptyPortlet" aria-labelledby="p-cactions-label">
						<h3 tabindex="0" id="p-cactions-label"><span>More</span><a tabindex="-1" href="#"></a></h3>

						<div class="menu">
							<ul>
															</ul>
						</div>
					</div>
										<div id="p-search" role="search">
						<h3>
							<label for="searchInput">Search</label>
						</h3>

						<form action="/w/index.php" id="searchform">
														<div id="simpleSearch">
															<input autocomplete="off" tabindex="1" name="search" placeholder="Search" title="Search Wikipedia [Alt+Shift+f]" accesskey="f" id="searchInput" type="search"><input value="Special:Search" name="title" type="hidden"><input name="go" value="Go" title="Go to a page with this exact name if one exists" id="searchButton" class="searchButton" type="submit">								</div>
						</form>
					</div>
									</div>
			</div>
			<div id="mw-panel">
				<div id="p-logo" role="banner"><a style="background-image: url(//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png);" href="http://en.wikipedia.org/wiki/Main_Page" title="Visit the main page"></a></div>
						<div class="portal first" role="navigation" id="p-navigation" aria-labelledby="p-navigation-label">
			<h3 id="p-navigation-label">Navigation</h3>

			<div class="body">
									<ul>
													<li id="n-mainpage-description"><a href="http://en.wikipedia.org/wiki/Main_Page" title="Visit the main page [Alt+Shift+z]" accesskey="z">Main page</a></li>
													<li id="n-contents"><a href="http://en.wikipedia.org/wiki/Portal:Contents" title="Guides to browsing Wikipedia">Contents</a></li>
													<li id="n-featuredcontent"><a href="http://en.wikipedia.org/wiki/Portal:Featured_content" title="Featured content – the best of Wikipedia">Featured content</a></li>
													<li id="n-currentevents"><a href="http://en.wikipedia.org/wiki/Portal:Current_events" title="Find background information on current events">Current events</a></li>
													<li id="n-randompage"><a href="http://en.wikipedia.org/wiki/Special:Random" title="Load a random article [Alt+Shift+x]" accesskey="x">Random article</a></li>
													<li id="n-sitesupport"><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_en.wikipedia.org&amp;uselang=en" title="Support us">Donate to Wikipedia</a></li>
													<li id="n-shoplink"><a href="http://shop.wikimedia.org/" title="Visit the Wikimedia Shop">Wikimedia Shop</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id="p-interaction" aria-labelledby="p-interaction-label">
			<h3 id="p-interaction-label">Interaction</h3>

			<div class="body">
									<ul>
													<li id="n-help"><a href="http://en.wikipedia.org/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia">Help</a></li>
													<li id="n-aboutsite"><a href="http://en.wikipedia.org/wiki/Wikipedia:About" title="Find out about Wikipedia">About Wikipedia</a></li>
													<li id="n-portal"><a href="http://en.wikipedia.org/wiki/Wikipedia:Community_portal" title="About the project, what you can do, where to find things">Community portal</a></li>
													<li id="n-recentchanges"><a href="http://en.wikipedia.org/wiki/Special:RecentChanges" title="A list of recent changes in the wiki [Alt+Shift+r]" accesskey="r">Recent changes</a></li>
													<li id="n-contactpage"><a href="http://en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact page</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id="p-tb" aria-labelledby="p-tb-label">
			<h3 id="p-tb-label">Tools</h3>

			<div class="body">
									<ul>
													<li id="t-whatlinkshere"><a href="http://en.wikipedia.org/wiki/Special:WhatLinksHere/C%2B%2B11" title="List of all English Wikipedia pages containing links to this page [Alt+Shift+j]" accesskey="j">What links here</a></li>
													<li id="t-recentchangeslinked"><a href="http://en.wikipedia.org/wiki/Special:RecentChangesLinked/C%2B%2B11" title="Recent changes in pages linked from this page [Alt+Shift+k]" accesskey="k">Related changes</a></li>
													<li id="t-upload"><a href="http://en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [Alt+Shift+u]" accesskey="u">Upload file</a></li>
													<li id="t-specialpages"><a href="http://en.wikipedia.org/wiki/Special:SpecialPages" title="A list of all special pages [Alt+Shift+q]" accesskey="q">Special pages</a></li>
													<li id="t-permalink"><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;oldid=614206455" title="Permanent link to this revision of the page">Permanent link</a></li>
													<li id="t-info"><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;action=info">Page information</a></li>
													<li id="t-wikibase"><a href="http://www.wikidata.org/wiki/Q1061570" title="Link to connected data repository item [Alt+Shift+g]" accesskey="g">Wikidata item</a></li>
						<li id="t-cite"><a href="http://en.wikipedia.org/w/index.php?title=Special:Cite&amp;page=C%2B%2B11&amp;id=614206455" title="Information on how to cite this page">Cite this page</a></li>					</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id="p-coll-print_export" aria-labelledby="p-coll-print_export-label">
			<h3 id="p-coll-print_export-label">Print/export</h3>

			<div class="body">
									<ul>
													<li id="coll-create_a_book"><a href="http://en.wikipedia.org/w/index.php?title=Special:Book&amp;bookcmd=book_creator&amp;referer=C%2B%2B11">Create a book</a></li>
													<li id="coll-download-as-rl"><a href="http://en.wikipedia.org/w/index.php?title=Special:Book&amp;bookcmd=render_article&amp;arttitle=C%2B%2B11&amp;oldid=614206455&amp;writer=rl">Download as PDF</a></li>
													<li id="t-print"><a href="http://en.wikipedia.org/w/index.php?title=C%2B%2B11&amp;printable=yes" title="Printable version of this page [Alt+Shift+p]" accesskey="p">Printable version</a></li>
											</ul>
							</div>
		</div>
			<div class="portal" role="navigation" id="p-lang" aria-labelledby="p-lang-label"><span aria-haspopup="true" role="button" tabindex="0" title="Language settings" class="uls-settings-trigger"></span>
			<h3 id="p-lang-label">Languages</h3>

			<div class="body">
									<ul>
													<li class="interlanguage-link interwiki-cs"><a href="http://cs.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Czech" hreflang="cs" lang="cs">Čeština</a></li>
													<li class="interlanguage-link interwiki-es"><a href="http://es.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Spanish" hreflang="es" lang="es">Español</a></li>
													<li class="interlanguage-link interwiki-fr"><a href="http://fr.wikipedia.org/wiki/C%2B%2B11" title="C++11 – French" hreflang="fr" lang="fr">Français</a></li>
													<li class="interlanguage-link interwiki-ko"><a href="http://ko.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Korean" hreflang="ko" lang="ko">한국어</a></li>
													<li class="interlanguage-link interwiki-it"><a href="http://it.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Italian" hreflang="it" lang="it">Italiano</a></li>
													<li class="interlanguage-link interwiki-ja"><a href="http://ja.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Japanese" hreflang="ja" lang="ja">日本語</a></li>
													<li class="interlanguage-link interwiki-pl"><a href="http://pl.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Polish" hreflang="pl" lang="pl">Polski</a></li>
													<li class="interlanguage-link interwiki-pt"><a href="http://pt.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Portuguese" hreflang="pt" lang="pt">Português</a></li>
													<li class="interlanguage-link interwiki-ru"><a href="http://ru.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Russian" hreflang="ru" lang="ru">Русский</a></li>
													<li class="interlanguage-link interwiki-sr"><a href="http://sr.wikipedia.org/wiki/%D0%9D%D0%B0%D1%86%D1%80%D1%82_C%2B%2B0x_%D0%BE%D0%B4_%D0%BC%D0%B0%D1%80%D1%82%D0%B0_2010." title="Нацрт C++0x од марта 2010. – Serbian" hreflang="sr" lang="sr">Српски / srpski</a></li>
													<li class="interlanguage-link interwiki-fi"><a href="http://fi.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Finnish" hreflang="fi" lang="fi">Suomi</a></li>
													<li class="interlanguage-link interwiki-sv"><a href="http://sv.wikipedia.org/wiki/C%2B%2B#Historia" title="C++ – Swedish" hreflang="sv" lang="sv">Svenska</a></li>
													<li class="interlanguage-link interwiki-th"><a href="http://th.wikipedia.org/wiki/%E0%B8%A0%E0%B8%B2%E0%B8%A9%E0%B8%B2%E0%B8%8B%E0%B8%B5%E0%B8%9E%E0%B8%A5%E0%B8%B1%E0%B8%AA%E0%B8%9E%E0%B8%A5%E0%B8%B1%E0%B8%AA%E0%B9%82%E0%B8%AD%E0%B9%80%E0%B8%AD%E0%B8%81%E0%B8%8B%E0%B9%8C" title="ภาษาซีพลัสพลัสโอเอกซ์ – Thai" hreflang="th" lang="th">ไทย</a></li>
													<li class="interlanguage-link interwiki-uk"><a href="http://uk.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Ukrainian" hreflang="uk" lang="uk">Українська</a></li>
													<li class="interlanguage-link interwiki-vi"><a href="http://vi.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Vietnamese" hreflang="vi" lang="vi">Tiếng Việt</a></li>
													<li class="interlanguage-link interwiki-zh"><a href="http://zh.wikipedia.org/wiki/C%2B%2B11" title="C++11 – Chinese" hreflang="zh" lang="zh">中文</a></li>
													
											</ul>
				<div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a action="edit" href="http://www.wikidata.org/wiki/Q1061570#sitelinks-wikipedia" text="Edit links" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div>			</div>
		</div>
				</div>
		</div>
		<div id="footer" role="contentinfo">
							<ul id="footer-info">
											<li id="footer-info-lastmod"> This page was last modified on 24 June 2014 at 09:31.<br></li>
											<li id="footer-info-copyright">Text is available under the <a rel="license" href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons Attribution-ShareAlike License</a><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/" style="display:none;"></a>;
additional terms may apply.  By using this site, you agree to the <a href="http://wikimediafoundation.org/wiki/Terms_of_Use">Terms of Use</a> and <a href="http://wikimediafoundation.org/wiki/Privacy_policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a href="http://www.wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li>
									</ul>
							<ul id="footer-places">
											<li id="footer-places-privacy"><a href="http://wikimediafoundation.org/wiki/Privacy_policy" title="wikimedia:Privacy policy">Privacy policy</a></li>
											<li id="footer-places-about"><a href="http://en.wikipedia.org/wiki/Wikipedia:About" title="Wikipedia:About">About Wikipedia</a></li>
											<li id="footer-places-disclaimer"><a href="http://en.wikipedia.org/wiki/Wikipedia:General_disclaimer" title="Wikipedia:General disclaimer">Disclaimers</a></li>
											<li id="footer-places-contact"><a href="http://en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li>
											<li id="footer-places-developers"><a href="https://www.mediawiki.org/wiki/Special:MyLanguage/How_to_contribute">Developers</a></li>
											<li id="footer-places-mobileview"><a href="http://en.m.wikipedia.org/wiki/C%2B%2B11" class="noprint stopMobileRedirectToggle">Mobile view</a></li>
									</ul>
										<ul id="footer-icons" class="noprint">
											<li id="footer-copyrightico">
															<a href="http://wikimediafoundation.org/"><img src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/wikimedia-button.png" alt="Wikimedia Foundation" height="31" width="88"></a>
													</li>
											<li id="footer-poweredbyico">
															<a href="http://www.mediawiki.org/"><img src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" height="31" width="88"></a>
													</li>
									</ul>
						<div style="clear:both"></div>
		</div>
		<script>/*<![CDATA[*/window.jQuery && jQuery.ready();/*]]>*/</script><script>if(window.mw){
mw.loader.state({"site":"loading","user":"ready","user.groups":"ready"});
}</script>
<script>if(window.mw){
mw.loader.load(["ext.cite","mediawiki.toc","mobile.desktop","mediawiki.action.view.postEdit","mediawiki.user","mediawiki.hidpi","mediawiki.page.ready","mediawiki.searchSuggest","ext.gadget.teahouse","ext.gadget.ReferenceTooltips","ext.gadget.DRN-wizard","ext.gadget.charinsert","ext.gadget.refToolbar","mmv.bootstrap.autostart","ext.eventLogging.subscriber","ext.navigationTiming","schema.UniversalLanguageSelector","ext.uls.eventlogger","ext.uls.interlanguage"],null,true);
}</script>
<script src="C++11%20-%20Wikipedia,%20the%20free%20encyclopedia_files/load_003.php"></script>
<script>if(window.mw){
mw.config.set({"wgBackendResponseTime":310,"wgHostname":"mw1064"});
}</script>
	

	<div class="suggestions" style="display: none; font-size: 13px;"><div class="suggestions-results"></div><div class="suggestions-special"></div></div><div style="left: 0px; top: 0px; position: absolute; width: 29px; height: 27px; border: medium none; margin: 0px; padding: 0px; z-index: 2147483647; display: none;" class="sbi_search" id="sbi_camera_button"></div></body></html>